Skip to content

Commit 9578420

Browse files
authored
Merge pull request #393 from lifeomic/csf3-s3
Update third batch of S- Components to Storybook CSF3
2 parents db2f460 + 149f942 commit 9578420

File tree

3 files changed

+116
-101
lines changed

3 files changed

+116
-101
lines changed
Lines changed: 60 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,83 @@
1-
import React from 'react';
2-
import { ComponentStory, ComponentMeta } from '@storybook/react';
1+
import { StoryObj, Meta } from '@storybook/react';
32

43
import { Slider } from './Slider';
54

6-
export default {
7-
title: 'Components/Slider',
5+
const meta: Meta<typeof Slider> = {
86
component: Slider,
9-
argTypes: {},
10-
} as ComponentMeta<typeof Slider>;
11-
12-
const Template: ComponentStory<typeof Slider> = (args) => <Slider {...args} />;
13-
14-
export const Default = Template.bind({});
15-
Default.args = {
16-
label: 'Slider',
7+
args: {
8+
label: 'Slider',
9+
},
1710
};
11+
export default meta;
12+
type Story = StoryObj<typeof Slider>;
1813

19-
export const LabelPlacement = Template.bind({});
20-
LabelPlacement.args = {
21-
label: 'Slider',
22-
labelPlacement: 'bottom',
23-
};
14+
export const Default: Story = {};
2415

25-
export const HelpMessage = Template.bind({});
26-
HelpMessage.args = {
27-
label: 'Slider',
28-
helpMessage: 'Help Message',
16+
export const LabelPlacement: Story = {
17+
args: {
18+
labelPlacement: 'bottom',
19+
},
2920
};
3021

31-
export const Value = Template.bind({});
32-
Value.args = {
33-
label: 'Slider',
34-
value: 40,
22+
export const HelpMessage: Story = {
23+
args: {
24+
helpMessage: 'Help Message',
25+
},
3526
};
3627

37-
export const ShowValue = Template.bind({});
38-
ShowValue.args = {
39-
label: 'Slider',
40-
value: 40,
41-
showValue: true,
28+
export const Value: Story = {
29+
args: {
30+
value: 40,
31+
},
4232
};
4333

44-
export const FormatValue = Template.bind({});
45-
FormatValue.args = {
46-
label: 'Slider',
47-
value: 40,
48-
formatValue: (value: number | undefined) => `${value} cm`,
34+
export const ShowValue: Story = {
35+
args: {
36+
value: 40,
37+
showValue: true,
38+
},
4939
};
5040

51-
export const Disabled = Template.bind({});
52-
Disabled.args = {
53-
label: 'Slider',
54-
disabled: true,
41+
export const FormatValue: Story = {
42+
args: {
43+
value: 40,
44+
formatValue: (value: number | undefined) => `${value} cm`,
45+
},
5546
};
5647

57-
export const Error = Template.bind({});
58-
Error.args = {
59-
label: 'Slider',
60-
hasError: true,
61-
errorMessage: 'Error Message',
48+
export const Disabled: Story = {
49+
args: {
50+
disabled: true,
51+
},
6252
};
6353

64-
export const InverseDark = Template.bind({});
65-
InverseDark.parameters = {
66-
backgrounds: { default: 'dark' },
67-
};
68-
InverseDark.args = {
69-
label: 'Slider',
70-
value: 40,
71-
color: 'inverse',
72-
helpMessage: 'Help Message',
73-
showValue: true,
74-
formatValue: (value: number | undefined) => `${value} cm`,
54+
export const Error: Story = {
55+
args: {
56+
hasError: true,
57+
errorMessage: 'Error Message',
58+
},
7559
};
7660

77-
export const InverseBlue = Template.bind({});
78-
InverseBlue.parameters = {
79-
backgrounds: { default: 'blue' },
61+
export const InverseDark: Story = {
62+
parameters: {
63+
backgrounds: { default: 'dark' },
64+
},
65+
args: {
66+
value: 40,
67+
color: 'inverse',
68+
helpMessage: 'Help Message',
69+
showValue: true,
70+
},
8071
};
81-
InverseBlue.args = {
82-
label: 'Slider',
83-
value: 40,
84-
color: 'inverse',
85-
helpMessage: 'Help Message',
86-
showValue: true,
87-
formatValue: (value: number | undefined) => `${value} cm`,
72+
73+
export const InverseBlue: Story = {
74+
parameters: {
75+
backgrounds: { default: 'blue' },
76+
},
77+
args: {
78+
value: 40,
79+
color: 'inverse',
80+
helpMessage: 'Help Message',
81+
showValue: true,
82+
},
8883
};
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
11
import React from 'react';
2-
import { ComponentStory, ComponentMeta } from '@storybook/react';
2+
import { StoryObj, Meta } from '@storybook/react';
33

44
import { SmallTile } from './SmallTile';
55
import { SmallTileContent } from './SmallTileContent';
66
import { SmallTileFooter } from './SmallTileFooter';
77

8-
export default {
9-
title: 'Components/SmallTile',
8+
const meta: Meta<typeof SmallTile> = {
109
component: SmallTile,
11-
argTypes: {},
10+
args: {
11+
children: (
12+
<>
13+
<SmallTileContent text="Title Text" />
14+
<SmallTileFooter text="Footer Text" />
15+
</>
16+
),
17+
},
1218
subcomponents: {
1319
SmallTileContent,
1420
SmallTileFooter,
1521
},
16-
} as ComponentMeta<typeof SmallTile>;
17-
18-
const Template: ComponentStory<typeof SmallTile> = (args) => (
19-
<SmallTile {...args} />
20-
);
21-
22-
export const Default = Template.bind({});
23-
Default.args = {
24-
children: (
25-
<>
26-
<SmallTileContent text="Title Text" />
27-
<SmallTileFooter text="Footer Text" />
28-
</>
29-
),
3022
};
23+
export default meta;
24+
type Story = StoryObj<typeof SmallTile>;
25+
26+
export const Default: Story = {};
Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,50 @@
11
import React from 'react';
2-
import { ComponentStory, ComponentMeta } from '@storybook/react';
2+
import { StoryObj, Meta } from '@storybook/react';
33

44
import { Snackbar } from './Snackbar';
55
import { Button } from '../Button';
6+
import { AlertTriangle } from '@lifeomic/chromicons';
67

7-
export default {
8-
title: 'Components/Snackbar',
8+
const meta: Meta<typeof Snackbar> = {
99
component: Snackbar,
10-
argTypes: {},
11-
} as ComponentMeta<typeof Snackbar>;
12-
13-
const Template: ComponentStory<typeof Snackbar> = (args) => (
14-
<Snackbar {...args} />
15-
);
10+
args: {
11+
isOpen: true,
12+
children: (
13+
<>
14+
<span>This is child text with a call to action</span>
15+
<Button style={{ marginLeft: 8 }}>Button</Button>
16+
</>
17+
),
18+
},
19+
decorators: [
20+
(story: Function) => (
21+
<div
22+
style={{
23+
height: '100px',
24+
}}
25+
>
26+
{story()}
27+
</div>
28+
),
29+
],
30+
};
31+
export default meta;
32+
type Story = StoryObj<typeof Snackbar>;
1633

17-
export const Default = Template.bind({});
18-
Default.args = {
19-
isOpen: true,
20-
children: (
21-
<>
22-
<span>This is child text with a call to action</span>
23-
<Button style={{ marginLeft: 8 }}>Button</Button>
24-
</>
25-
),
34+
export const Default: Story = {};
35+
export const Icon: Story = {
36+
args: {
37+
icon: AlertTriangle,
38+
statusType: 'error',
39+
role: 'alert',
40+
allowDismiss: true,
41+
children: (
42+
<>
43+
<span>Warning</span>
44+
<Button style={{ marginLeft: 8 }} color="negative">
45+
Button
46+
</Button>
47+
</>
48+
),
49+
},
2650
};

0 commit comments

Comments
 (0)