|
1 | | -import type {Meta, StoryFn} from '@storybook/react-webpack5'; |
| 1 | +import * as React from 'react'; |
2 | 2 |
|
| 3 | +import type {Meta, StoryObj} from '@storybook/react-webpack5'; |
| 4 | + |
| 5 | +import {Showcase} from '../../../demo/Showcase'; |
| 6 | +import {ShowcaseItem} from '../../../demo/ShowcaseItem'; |
3 | 7 | import {Spin} from '../Spin'; |
4 | | -import type {SpinProps} from '../Spin'; |
5 | 8 |
|
6 | 9 | export default { |
7 | 10 | title: 'Components/Feedback/Spin', |
8 | 11 | component: Spin, |
9 | 12 | } as Meta; |
10 | 13 |
|
11 | | -const DefaultTemplate: StoryFn<SpinProps> = (args) => <Spin {...args} />; |
12 | | -export const Default = DefaultTemplate.bind({}); |
| 14 | +type Story = StoryObj<typeof Spin>; |
| 15 | + |
| 16 | +const defaultDecorators = [ |
| 17 | + (Story) => ( |
| 18 | + <Showcase> |
| 19 | + <Story /> |
| 20 | + </Showcase> |
| 21 | + ), |
| 22 | +] satisfies Story['decorators']; |
| 23 | + |
| 24 | +export const Default: Story = {}; |
13 | 25 |
|
14 | | -const SizeTemplate: StoryFn<SpinProps> = (args) => ( |
15 | | - <div> |
16 | | - xs: <Spin {...args} size="xs" /> |
17 | | - <span style={{margin: '16px'}} /> |
18 | | - s: <Spin {...args} size="s" /> |
19 | | - <span style={{margin: '16px'}} /> |
20 | | - m: <Spin {...args} size="m" /> |
21 | | - <span style={{margin: '16px'}} /> |
22 | | - l: <Spin {...args} size="l" /> |
23 | | - <span style={{margin: '16px'}} /> |
24 | | - xl: <Spin {...args} size="xl" /> |
25 | | - </div> |
26 | | -); |
27 | | -export const Size = SizeTemplate.bind({}); |
| 26 | +export const Size: Story = { |
| 27 | + decorators: defaultDecorators, |
| 28 | + render: (args) => ( |
| 29 | + <React.Fragment> |
| 30 | + <ShowcaseItem title="Size xs"> |
| 31 | + <Spin {...args} size="xs" /> |
| 32 | + </ShowcaseItem> |
| 33 | + <ShowcaseItem title="Size s"> |
| 34 | + <Spin {...args} size="s" /> |
| 35 | + </ShowcaseItem> |
| 36 | + <ShowcaseItem title="Size m"> |
| 37 | + <Spin {...args} size="m" /> |
| 38 | + </ShowcaseItem> |
| 39 | + <ShowcaseItem title="Size l"> |
| 40 | + <Spin {...args} size="l" /> |
| 41 | + </ShowcaseItem> |
| 42 | + <ShowcaseItem title="Size xl"> |
| 43 | + <Spin {...args} size="xl" /> |
| 44 | + </ShowcaseItem> |
| 45 | + </React.Fragment> |
| 46 | + ), |
| 47 | +}; |
0 commit comments