mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:01:21 +08:00
29 lines
617 B
Plaintext
29 lines
617 B
Plaintext
```ts
|
|
// MyComponent.stories.ts
|
|
|
|
import { MyComponent } from './MyComponent.component';
|
|
|
|
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 = {
|
|
args: {
|
|
data: simpleData
|
|
},
|
|
};
|
|
|
|
export const ComplexStory = {
|
|
args: {
|
|
data: complexData
|
|
},
|
|
};
|
|
```
|