Skip to content

Commit 3897312

Browse files
committed
adjust pill story as csf3
1 parent c5d3432 commit 3897312

File tree

1 file changed

+73
-41
lines changed

1 file changed

+73
-41
lines changed

stories/Pill.stories.tsx

Lines changed: 73 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,95 @@ import React from 'react';
22
import { action } from '@storybook/addon-actions';
33
import { text, boolean } from '@storybook/addon-knobs';
44
import { Pill } from '../src/scripts';
5-
export default {
5+
import { ComponentMeta, ComponentStoryObj } from '@storybook/react';
6+
import { containerDecorator } from './util';
7+
8+
/**
9+
*
10+
*/
11+
const meta: ComponentMeta<typeof Pill> = {
612
title: 'Pill',
13+
component: Pill,
14+
argTypes: {
15+
onClick: { action: 'click' },
16+
onRemove: { action: 'remove' },
17+
},
718
};
8-
export const ControlledWithKnobs = {
9-
render: () => (
10-
<Pill
11-
label={text('label', 'Pill Label')}
12-
truncate={boolean('truncate', false)}
13-
disabled={boolean('disabled', false)}
14-
onClick={action('onclick')}
15-
onRemove={action('onRemove')}
16-
/>
17-
),
19+
export default meta;
20+
21+
/**
22+
*
23+
*/
24+
export const ControlledWithKnobs: ComponentStoryObj<typeof Pill> = {
1825
name: 'Controlled with knobs',
26+
args: {
27+
label: 'Pill Label',
28+
},
1929
parameters: {
2030
info: 'Pill controlled with knobs',
2131
},
2232
};
23-
export const WithIcon = {
24-
render: () => (
25-
<Pill
26-
label='Pill Label'
27-
icon={{
28-
category: 'standard',
29-
icon: 'account',
30-
}}
31-
/>
32-
),
33+
34+
/**
35+
*
36+
*/
37+
export const WithIcon: ComponentStoryObj<typeof Pill> = {
3338
name: 'with icon',
39+
args: {
40+
label: 'Pill Label',
41+
icon: {
42+
category: 'standard',
43+
icon: 'account',
44+
},
45+
},
3446
parameters: {
35-
info: 'Pill with icon',
47+
docs: {
48+
description: {
49+
story: 'Pill with icon',
50+
},
51+
},
3652
},
3753
};
38-
export const Disabled = {
39-
render: () => <Pill label='Pill Label' disabled />,
54+
55+
/**
56+
*
57+
*/
58+
export const Disabled: ComponentStoryObj<typeof Pill> = {
4059
name: 'disabled',
60+
args: {
61+
label: 'Pill Label',
62+
disabled: true,
63+
},
4164
parameters: {
42-
info: 'Pill with disabled status',
65+
docs: {
66+
description: {
67+
story: 'Pill with disabled status',
68+
},
69+
},
4370
},
4471
};
45-
export const Truncate = {
46-
render: () => (
47-
<div
48-
style={{
49-
width: '200px',
50-
}}
51-
>
52-
<div className='slds-pill_container'>
53-
<Pill
54-
label='Pill Label that is longer than the area that contains it'
55-
truncate
56-
/>
57-
</div>
58-
</div>
59-
),
72+
73+
/**
74+
*
75+
*/
76+
export const Truncate: ComponentStoryObj<typeof Pill> = {
6077
name: 'truncate',
78+
args: {
79+
label: 'Pill Label that is longer than the area that contains it',
80+
truncate: true,
81+
},
82+
decorators: [
83+
(story) => (
84+
<div style={{ width: 200 }}>
85+
<div className='slds-pill_container'>{story()}</div>
86+
</div>
87+
),
88+
],
6189
parameters: {
62-
info: 'Pill with truncated label',
90+
docs: {
91+
description: {
92+
story: 'Pill with truncated label',
93+
},
94+
},
6395
},
6496
};

0 commit comments

Comments
 (0)