storybook/docs/snippets/svelte/my-component-story-with-nonstory.js.mdx
2021-05-06 17:36:21 +01:00

32 lines
706 B
Plaintext

```js
// MyComponent.stories.js
import MyComponent from './MyComponent.svelte';
import someData from './data.json';
export default {
title: 'MyComponent',
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 = () => ({
Component: MyComponent,
props: {
data: simpleData,
},
});
export const ComplexStory = () => ({
Component: MyComponent,
props: {
data: complexData,
},
});
```