Skip to content

Commit ec17bcd

Browse files
gitstart-twentyv1b3mRubensRafael
authored andcommitted
Add ui/progress-bar stories (twentyhq#936)
* Add ui/progress-bar stories Co-authored-by: v1b3m <[email protected]> Co-authored-by: RubensRafael <[email protected]> * Add requested changes Co-authored-by: RubensRafael <[email protected]> Co-authored-by: v1b3m <[email protected]> --------- Co-authored-by: v1b3m <[email protected]> Co-authored-by: RubensRafael <[email protected]>
1 parent 9176935 commit ec17bcd

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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

Comments
 (0)