Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix(global): storybook defaultValue and options will be deprecated. #287

Open
wants to merge 1 commit into
base: release/1.9.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions packages/react-accordion/docs/react-accordion-demo.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ Demo.args = {
title: 'Accordion Item',
icon: 'wpmudev-logo',
image: LogoImage,
checkboxInput: true,
checkboxInput: true,
checkboxId: 'accordion-item-1',
checkboxSelected: false,
checkboxClickHandler: null,
children: (
<div className="sui-box">
<div className="sui-box-body">
Expand Down Expand Up @@ -88,7 +90,6 @@ Demo.argTypes = {
description: 'Whether to show or hide checkbox.',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: 'false' },
},
control: {
type: 'boolean',
Expand All @@ -98,7 +99,6 @@ Demo.argTypes = {
description: 'Id of accordion checkbox.',
table: {
type: { summary: 'string' },
defaultValue: { summary: 'null' },
},
control: {
type: 'text',
Expand All @@ -108,7 +108,6 @@ Demo.argTypes = {
description: 'Whether the checkbox should be default selected.',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: 'false' },
},
control: {
type: 'boolean',
Expand All @@ -118,7 +117,6 @@ Demo.argTypes = {
description: 'Checkbox click event handler.',
table: {
type: { summary: 'function' },
defaultValue: { summary: 'null' },
},
control: {
type: null,
Expand Down
6 changes: 1 addition & 5 deletions packages/react-box/docs/box-body.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@ DefaultBody.storyName = 'Body';
DefaultBody.args = {};
DefaultBody.argTypes = {
alignment: {
options: ['left', 'center', 'right'],
type: {
name: 'string',
required: false,
},
description: 'Description goes here...',
control: {
type: 'select',
options: {
left: 'left',
center: 'center',
right: 'right',
},
},
},
paddingTop: {
Expand Down
44 changes: 17 additions & 27 deletions packages/react-box/docs/box-footer.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,32 @@ const Template = (args) => {

export const SingleAction = Template.bind({});
SingleAction.storyName = 'Single Action';
SingleAction.args = {};
SingleAction.args = {
children: <Button label="Save Changes" color="blue" />,
};
SingleAction.argTypes = {
display: {
name: 'Display',
options: ['block', 'inline'],
type: {
name: 'string',
required: false,
},
description: 'Description goes here...',
control: {
type: 'select',
options: {
block: 'block',
inline: 'inline',
},
},
},
alignment: {
name: 'Alignment',
options: ['left', 'center', 'right'],
type: {
name: 'string',
required: false,
},
description: 'Description goes here...',
control: {
type: 'select',
options: {
default: '',
center: 'center',
right: 'right',
},
},
},
paddingTop: {
Expand Down Expand Up @@ -121,9 +116,6 @@ SingleAction.argTypes = {
type: 'text',
},
},
children: {
defaultValue: <Button label="Save Changes" color="blue" />,
},
};
SingleAction.parameters = {
controls: {
Expand All @@ -133,26 +125,22 @@ SingleAction.parameters = {

export const DoubleAction = Template.bind({});
DoubleAction.storyName = 'Double Action';
DoubleAction.args = {};
DoubleAction.argTypes = {
...SingleAction.argTypes,
children: {
defaultValue: (
DoubleAction.args = {
children: (
<>
<Button label="Save Changes" color="blue" />
<Button label="Cancel" icon="close" design="ghost" />
</>
),
},
)
};
DoubleAction.argTypes = {
...SingleAction.argTypes,
};

export const JointActions = Template.bind({});
JointActions.storyName = 'Joint Actions';
JointActions.args = {};
JointActions.argTypes = {
...SingleAction.argTypes,
children: {
defaultValue: (
JointActions.args = {
children: (
<>
<p className="sui-description" style={{ marginTop: 5, marginBottom: 5 }}>
Save your progress
Expand All @@ -162,6 +150,8 @@ JointActions.argTypes = {
<Button label="Draft Changes" design="ghost" />
</div>
</>
),
},
),
};
JointActions.argTypes = {
...SingleAction.argTypes,
};
33 changes: 6 additions & 27 deletions packages/react-box/docs/box-header.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ SimpleHeader.argTypes = {
},
},
tagColor: {
options: ['default', 'red', 'yellow', 'green', 'blue', 'purple'],
type: {
name: 'string',
required: false,
Expand All @@ -62,57 +63,39 @@ SimpleHeader.argTypes = {
'By default **tags background** color is a subtle `light gray` but you can change this for any of the options suggested in the control selector: red, yellow, green, blue, purple. You can also leave this option empty, or simply not include it, to get default color.',
control: {
type: 'select',
options: {
default: '',
red: 'red',
yellow: 'yellow',
green: 'green',
blue: 'blue',
purple: 'purple',
},
},
},
tagSize: {
options: ['default', 'small'],
type: {
name: 'string',
required: false,
},
description: 'By default ',
control: {
type: 'select',
options: {
default: '',
small: 'small',
},
},
},
display: {
options: ['block', 'inline'],
type: {
name: 'string',
required: false,
},
description: 'Description goes here...',
control: {
type: 'select',
options: {
block: 'block',
inline: 'inline',
},
},
},
alignment: {
options: ['left', 'center', 'right'],
type: {
name: 'string',
required: false,
},
description: 'Description goes here...',
control: {
type: 'select',
options: {
default: '',
center: 'center',
right: 'right',
},
},
},
paddingTop: {
Expand Down Expand Up @@ -199,22 +182,18 @@ export const ActionHeader = Template.bind({});
ActionHeader.storyName = 'Title with Content';
ActionHeader.args = {
...SimpleHeader.args,
children: <Button label="Right Action" color="blue" />,
};
ActionHeader.argTypes = {
...SimpleHeader.argTypes,
children: {
defaultValue: <Button label="Right Action" color="blue" />,
},
};

export const UntitledHeader = Template.bind({});
UntitledHeader.storyName = 'Content Only';
UntitledHeader.args = {
alignment: 'right',
children: <Button label="Right Action" color="blue" />
};
UntitledHeader.argTypes = {
...SimpleHeader.argTypes,
children: {
defaultValue: <Button label="Right Action" color="blue" />,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,35 @@ demo.argTypes = {
},
},
iconSize: {
options: ['', 'sm', 'md', 'lg'],
description:
'By default, the icon has a 12px size but you can change it with this property. You could use either:',
table: {
type: { summary: 'sm | md | lg' },
},
control: {
type: 'select',
options: ['', 'sm', 'md', 'lg'],
},
},
design: {
options: ['', 'outlined'],
description: 'The button styles. It could be either solid (default) or outlined.',
table: {
type: { summary: 'string' },
},
control: {
type: 'select',
options: ['', 'outlined'],
},
},
color: {
options: ['', 'blue', 'green', 'red', 'orange', 'purple', 'yellow', 'white'],
description:
'The button comes in gray color by default but you can change that with this property.',
table: {
type: { summary: 'string' },
},
control: {
type: 'select',
options: ['', 'blue', 'green', 'red', 'orange', 'purple', 'yellow', 'white'],
},
},
className: {
Expand Down
Loading