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

✨ new(radio/checkbox): fixed storybook boolean error in radio/checkbox. #288

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
19 changes: 10 additions & 9 deletions packages/react-radio-checkbox/docs/react-checkbox.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default {
args: {
size: 'default',
type: 'checkbox',
stacked: false,
options: [
{
id: 'checkbox1',
Expand Down Expand Up @@ -41,6 +42,11 @@ export default {
options: ['default', 'small'],
},
},
stacked: {
control: {
type: 'boolean'
}
},
type: {
control: {
type: 'select',
Expand All @@ -62,27 +68,22 @@ const Template = ({ ...props }) => {

export const primary = Template.bind({});
primary.storyName = 'Default';
primary.args = {
stacked: false,
};

export const stacked = Template.bind({});
stacked.storyName = 'Stacked';
stacked.args = {
stacked: true,
}
};

export const small = Template.bind({});
small.storyName = 'Small';
small.args = {
size: 'small',
stacked: false,
}
};

export const disabled = Template.bind({});
disabled.storyName = 'Disabled';
disabled.args = {
stacked: false,
options: [
{
id: 'checkbox1',
Expand All @@ -101,7 +102,7 @@ disabled.args = {
disabled: true,
},
],
}
};

export const image = Template.bind({});
image.storyName = 'Image';
Expand Down Expand Up @@ -147,4 +148,4 @@ image.args = {
},
}
],
}
};
19 changes: 10 additions & 9 deletions packages/react-radio-checkbox/docs/react-radio.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default {
args: {
size: 'default',
type: 'radio',
stacked: false,
options: [
{
id: 'radio1',
Expand Down Expand Up @@ -41,6 +42,11 @@ export default {
options: ['default', 'small'],
},
},
stacked: {
control: {
type: 'boolean'
}
},
type: {
control: {
type: 'select',
Expand All @@ -62,27 +68,22 @@ const Template = ({ ...props }) => {

export const primary = Template.bind({});
primary.storyName = 'Default';
primary.args = {
stacked: false,
};

export const stacked = Template.bind({});
stacked.storyName = 'Stacked';
stacked.args = {
stacked: true,
}
};

export const small = Template.bind({});
small.storyName = 'Small';
small.args = {
size: 'small',
stacked: false,
}
};

export const disabled = Template.bind({});
disabled.storyName = 'Disabled';
disabled.args = {
stacked: false,
options: [
{
id: 'radio1',
Expand All @@ -101,7 +102,7 @@ disabled.args = {
disabled: true,
},
],
}
};

export const image = Template.bind({});
image.storyName = 'Image';
Expand Down Expand Up @@ -147,4 +148,4 @@ image.args = {
},
}
],
}
};
3 changes: 2 additions & 1 deletion packages/react-radio-checkbox/lib/react-radio-checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const RadioCheckboxInput = ({
image,
defaultChecked,
disabled,
stacked,
...props
}) => {

Expand All @@ -18,7 +19,7 @@ const RadioCheckboxInput = ({
mainClasses.push(`sui-${type}-sm`);
}

if (props.stacked) {
if (stacked) {
mainClasses.push(`sui-${type}-stacked`);
}

Expand Down