mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-06 15:31:16 +08:00
19 lines
519 B
Plaintext
19 lines
519 B
Plaintext
```js
|
|
// MyComponent.stories.js
|
|
|
|
import React from 'react';
|
|
import MyComponent from './MyComponent';
|
|
import someData from './data.json';
|
|
|
|
export default {
|
|
title: 'MyComponent',
|
|
component: MyComponent,
|
|
includeStories: ['SimpleStory', 'ComplexStory']
|
|
}
|
|
|
|
export const simpleData = { foo: 1, bar: 'baz' };
|
|
export const complexData = { foo: 1, { bar: 'baz', baz: someData }};
|
|
|
|
export const SimpleStory = () => <MyComponent data={simpleData} />;
|
|
export const ComplexStory = () => <MyComponent data={complexData} />;
|
|
``` |