Skip to content

Commit 5af04eb

Browse files
authored
chore(storybook): Convert stories from storiesOf to CSF format (#6663)
* chore(storybook): convert from storiesOf to CSF format * chore(storybook): hoist story annotations * chore(storybook): prep experimental pagination as well * chore(format): run formatting
1 parent 70d5847 commit 5af04eb

File tree

53 files changed

+4255
-4065
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+4255
-4065
lines changed

packages/react/src/components/Accordion/Accordion-story.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ export const accordion = () => (
7878

7979
export const skeleton = () => <AccordionSkeleton open count={4} />;
8080

81-
skeleton.story = {
82-
decorators: [(story) => <div style={{ width: '500px' }}>{story()}</div>],
83-
};
81+
skeleton.decorators = [
82+
(story) => <div style={{ width: '500px' }}>{story()}</div>,
83+
];
8484

8585
const props = {
8686
onClick: action('onClick'),

packages/react/src/components/Checkbox/Checkbox-story.js

Lines changed: 75 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
import React from 'react';
9-
import { storiesOf } from '@storybook/react';
109
import { action } from '@storybook/addon-actions';
1110
import { withKnobs, boolean, text } from '@storybook/addon-knobs';
1211
import Checkbox from '../Checkbox';
@@ -25,76 +24,83 @@ const props = () => ({
2524
onChange: action('onChange'),
2625
});
2726

28-
storiesOf('Checkbox', module)
29-
.addParameters({
27+
export default {
28+
title: 'Checkbox',
29+
decorators: [withKnobs],
30+
31+
parameters: {
3032
component: Checkbox,
33+
3134
subcomponents: {
3235
CheckboxSkeleton,
3336
},
34-
})
35-
.addDecorator(withKnobs)
36-
.add(
37-
'checked',
38-
() => {
39-
const checkboxProps = props();
40-
return (
41-
<fieldset className={`${prefix}--fieldset`}>
42-
<legend className={`${prefix}--label`}>Checkbox heading</legend>
43-
<Checkbox defaultChecked {...checkboxProps} id="checkbox-label-1" />
44-
<Checkbox defaultChecked {...checkboxProps} id="checkbox-label-2" />
45-
</fieldset>
46-
);
47-
},
48-
{
49-
info: {
50-
text: `
51-
Checkboxes are used when there is a list of options and the user may select multiple options, including all or none.
52-
The example below shows how the Checkbox component can be used as an uncontrolled component that is initially checked
53-
by setting the defaultChecked property to true. To use the component in a controlled way, you should set the
54-
checked property instead.
55-
`,
56-
},
57-
}
58-
)
59-
.add(
60-
'unchecked',
61-
() => {
62-
const checkboxProps = props();
63-
return (
64-
<fieldset className={`${prefix}--fieldset`}>
65-
<legend className={`${prefix}--label`}>Checkbox heading</legend>
66-
<Checkbox {...checkboxProps} id="checkbox-label-1" />
67-
<Checkbox {...checkboxProps} id="checkbox-label-2" />
68-
</fieldset>
69-
);
70-
},
71-
{
72-
info: {
73-
text: `
74-
Checkboxes are used when there is a list of options and the user may select multiple options, including all or none.
75-
The example below shows how the Checkbox component can be used as an uncontrolled component that is initially
76-
unchecked. To use the component in a controlled way, you should set the checked property instead.
77-
`,
78-
},
79-
}
80-
)
81-
.add(
82-
'skeleton',
83-
() => (
84-
<div
85-
aria-label="loading checkbox"
86-
aria-live="assertive"
87-
role="status"
88-
tabIndex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
89-
>
90-
<CheckboxSkeleton />
91-
</div>
92-
),
93-
{
94-
info: {
95-
text: `
96-
Placeholder skeleton state to use when content is loading.
97-
`,
98-
},
99-
}
37+
},
38+
};
39+
40+
export const Checked = () => {
41+
const checkboxProps = props();
42+
return (
43+
<fieldset className={`${prefix}--fieldset`}>
44+
<legend className={`${prefix}--label`}>Checkbox heading</legend>
45+
<Checkbox defaultChecked {...checkboxProps} id="checkbox-label-1" />
46+
<Checkbox defaultChecked {...checkboxProps} id="checkbox-label-2" />
47+
</fieldset>
48+
);
49+
};
50+
51+
Checked.storyName = 'checked';
52+
53+
Checked.parameters = {
54+
info: {
55+
text: `
56+
Checkboxes are used when there is a list of options and the user may select multiple options, including all or none.
57+
The example below shows how the Checkbox component can be used as an uncontrolled component that is initially checked
58+
by setting the defaultChecked property to true. To use the component in a controlled way, you should set the
59+
checked property instead.
60+
`,
61+
},
62+
};
63+
64+
export const Unchecked = () => {
65+
const checkboxProps = props();
66+
return (
67+
<fieldset className={`${prefix}--fieldset`}>
68+
<legend className={`${prefix}--label`}>Checkbox heading</legend>
69+
<Checkbox {...checkboxProps} id="checkbox-label-1" />
70+
<Checkbox {...checkboxProps} id="checkbox-label-2" />
71+
</fieldset>
10072
);
73+
};
74+
75+
Unchecked.storyName = 'unchecked';
76+
77+
Unchecked.parameters = {
78+
info: {
79+
text: `
80+
Checkboxes are used when there is a list of options and the user may select multiple options, including all or none.
81+
The example below shows how the Checkbox component can be used as an uncontrolled component that is initially
82+
unchecked. To use the component in a controlled way, you should set the checked property instead.
83+
`,
84+
},
85+
};
86+
87+
export const Skeleton = () => (
88+
<div
89+
aria-label="loading checkbox"
90+
aria-live="assertive"
91+
role="status"
92+
tabIndex="0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
93+
>
94+
<CheckboxSkeleton />
95+
</div>
96+
);
97+
98+
Skeleton.storyName = 'skeleton';
99+
100+
Skeleton.parameters = {
101+
info: {
102+
text: `
103+
Placeholder skeleton state to use when content is loading.
104+
`,
105+
},
106+
};

0 commit comments

Comments
 (0)