From 9fe1c4b5ec26b6420a30d328fa058f2eb0bb118a Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Fri, 21 Apr 2023 10:43:17 -0300
Subject: allow the example to add params to the testing context

---
 packages/web-util/src/stories.tsx | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

(limited to 'packages/web-util/src/stories.tsx')

diff --git a/packages/web-util/src/stories.tsx b/packages/web-util/src/stories.tsx
index a8a9fdf77..3f90be13a 100644
--- a/packages/web-util/src/stories.tsx
+++ b/packages/web-util/src/stories.tsx
@@ -323,6 +323,7 @@ function parseExampleImport(
           render: {
             component: exampleValue as FunctionComponent,
             props: {},
+            contextProps: {},
           },
         };
       }
@@ -367,19 +368,22 @@ export interface Group {
   list: ComponentItem[];
 }
 
-export interface ComponentItem {
+export interface ComponentItem<Props extends object = {}> {
   name: string;
-  examples: ExampleItem[];
+  examples: ExampleItem<Props>[];
 }
 
-export interface ExampleItem {
+export type ExampleItemSetup<Props extends object = {}> = {
+  component: FunctionalComponent<Props>;
+  props: Props;
+  contextProps: object;
+};
+
+export interface ExampleItem<Props extends object = {}> {
   group: string;
   component: string;
   name: string;
-  render: {
-    component: FunctionalComponent;
-    props: object;
-  };
+  render: ExampleItemSetup<Props>;
 }
 
 type ComponentOrFolder = MaybeComponent | MaybeFolder;
-- 
cgit v1.2.3

