allow the example to add params to the testing context

This commit is contained in:
Sebastian 2023-04-21 10:43:17 -03:00
parent d61c5808bd
commit 9fe1c4b5ec
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069

View File

@ -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;