storybook/docs/snippets/svelte/my-component-story-with-nonstory.js.mdx
2021-08-28 01:52:57 +01:00

35 lines
732 B
Plaintext

```js
// MyComponent.stories.js
import MyComponent from './MyComponent.svelte';
import someData from './data.json';
export default {
component: MyComponent,
includeStories: ['SimpleStory', 'ComplexStory'], // 👈 Storybook loads these stories
excludeStories: /.*Data$/, // 👈 Storybook ignores anything that contains Data
};
export const simpleData = { foo: 1, bar: 'baz' };
export const complexData = { foo: 1, foobar: { bar: 'baz', baz: someData } };
export const SimpleStory = {
render: () => ({
Component: MyComponent,
props: {
data: simpleData,
},
}),
};
export const ComplexStory = {
render: () => ({
Component: MyComponent,
props: {
data: complexData,
},
}),
};
```