From a16abfdf98ea0ef9a014fc42be5a321c5ea80e95 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Mon, 21 Nov 2022 15:47:08 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20new(radio/checkbox):=20fixed=20stor?= =?UTF-8?q?ybook=20boolean=20error=20in=20radio/checkbox.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docs/react-checkbox.stories.js | 19 ++++++++++--------- .../docs/react-radio.stories.js | 19 ++++++++++--------- .../lib/react-radio-checkbox.js | 3 ++- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/packages/react-radio-checkbox/docs/react-checkbox.stories.js b/packages/react-radio-checkbox/docs/react-checkbox.stories.js index 1f6c6468..417a58b4 100644 --- a/packages/react-radio-checkbox/docs/react-checkbox.stories.js +++ b/packages/react-radio-checkbox/docs/react-checkbox.stories.js @@ -7,6 +7,7 @@ export default { args: { size: 'default', type: 'checkbox', + stacked: false, options: [ { id: 'checkbox1', @@ -41,6 +42,11 @@ export default { options: ['default', 'small'], }, }, + stacked: { + control: { + type: 'boolean' + } + }, type: { control: { type: 'select', @@ -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', @@ -101,7 +102,7 @@ disabled.args = { disabled: true, }, ], -} +}; export const image = Template.bind({}); image.storyName = 'Image'; @@ -147,4 +148,4 @@ image.args = { }, } ], -} \ No newline at end of file +}; \ No newline at end of file diff --git a/packages/react-radio-checkbox/docs/react-radio.stories.js b/packages/react-radio-checkbox/docs/react-radio.stories.js index b671f9fa..e10997cf 100644 --- a/packages/react-radio-checkbox/docs/react-radio.stories.js +++ b/packages/react-radio-checkbox/docs/react-radio.stories.js @@ -7,6 +7,7 @@ export default { args: { size: 'default', type: 'radio', + stacked: false, options: [ { id: 'radio1', @@ -41,6 +42,11 @@ export default { options: ['default', 'small'], }, }, + stacked: { + control: { + type: 'boolean' + } + }, type: { control: { type: 'select', @@ -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', @@ -101,7 +102,7 @@ disabled.args = { disabled: true, }, ], -} +}; export const image = Template.bind({}); image.storyName = 'Image'; @@ -147,4 +148,4 @@ image.args = { }, } ], -} \ No newline at end of file +}; \ No newline at end of file diff --git a/packages/react-radio-checkbox/lib/react-radio-checkbox.js b/packages/react-radio-checkbox/lib/react-radio-checkbox.js index fbee40c0..875ba65e 100644 --- a/packages/react-radio-checkbox/lib/react-radio-checkbox.js +++ b/packages/react-radio-checkbox/lib/react-radio-checkbox.js @@ -9,6 +9,7 @@ const RadioCheckboxInput = ({ image, defaultChecked, disabled, + stacked, ...props }) => { @@ -18,7 +19,7 @@ const RadioCheckboxInput = ({ mainClasses.push(`sui-${type}-sm`); } - if (props.stacked) { + if (stacked) { mainClasses.push(`sui-${type}-stacked`); }