aboutsummaryrefslogtreecommitdiff
path: root/packages/web-util
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-04-21 10:43:17 -0300
committerSebastian <sebasjm@gmail.com>2023-04-21 10:43:17 -0300
commit9fe1c4b5ec26b6420a30d328fa058f2eb0bb118a (patch)
tree7b9bf565d125105ecf556adcb56b4abae04f428e /packages/web-util
parentd61c5808bd2207178c95d34d4d2f7cb85f3991d9 (diff)
downloadwallet-core-9fe1c4b5ec26b6420a30d328fa058f2eb0bb118a.tar.gz
wallet-core-9fe1c4b5ec26b6420a30d328fa058f2eb0bb118a.tar.bz2
wallet-core-9fe1c4b5ec26b6420a30d328fa058f2eb0bb118a.zip
allow the example to add params to the testing context
Diffstat (limited to 'packages/web-util')
-rw-r--r--packages/web-util/src/stories.tsx18
1 files changed, 11 insertions, 7 deletions
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;