|
| 1 | +import { Meta, StoryObj } from '@storybook/react'; |
| 2 | + |
| 3 | +import { CatalogDecorator } from '~/testing/decorators/CatalogDecorator'; |
| 4 | +import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator'; |
| 5 | + |
| 6 | +import { ProgressBar } from '../ProgressBar'; |
| 7 | + |
| 8 | +const meta: Meta<typeof ProgressBar> = { |
| 9 | + title: 'UI/ProgressBar/ProgressBar', |
| 10 | + component: ProgressBar, |
| 11 | + args: { |
| 12 | + duration: 10000, |
| 13 | + }, |
| 14 | +}; |
| 15 | + |
| 16 | +export default meta; |
| 17 | + |
| 18 | +type Story = StoryObj<typeof ProgressBar>; |
| 19 | +const args = {}; |
| 20 | +const defaultArgTypes = { |
| 21 | + control: false, |
| 22 | +}; |
| 23 | +export const Default: Story = { |
| 24 | + args, |
| 25 | + decorators: [ComponentDecorator], |
| 26 | +}; |
| 27 | + |
| 28 | +export const Catalog = { |
| 29 | + args: { |
| 30 | + ...args, |
| 31 | + }, |
| 32 | + argTypes: { |
| 33 | + barHeight: defaultArgTypes, |
| 34 | + barColor: defaultArgTypes, |
| 35 | + autoStart: defaultArgTypes, |
| 36 | + }, |
| 37 | + parameters: { |
| 38 | + catalog: [ |
| 39 | + { |
| 40 | + name: 'animation', |
| 41 | + values: [true, false], |
| 42 | + props: (autoStart: string) => ({ autoStart }), |
| 43 | + labels: (autoStart: string) => `AutoStart: ${autoStart}`, |
| 44 | + }, |
| 45 | + { |
| 46 | + name: 'colors', |
| 47 | + values: [undefined, 'blue'], |
| 48 | + props: (barColor: string) => ({ barColor }), |
| 49 | + labels: (color: string) => `Color: ${color ?? 'default'}`, |
| 50 | + }, |
| 51 | + { |
| 52 | + name: 'sizes', |
| 53 | + values: [undefined, 10], |
| 54 | + props: (barHeight: number) => ({ barHeight }), |
| 55 | + labels: (size: number) => `Size: ${size ? size + ' px' : 'default'}`, |
| 56 | + }, |
| 57 | + ], |
| 58 | + }, |
| 59 | + decorators: [CatalogDecorator], |
| 60 | +}; |
0 commit comments