[18/n][Storybook] Switch update argTypes and add stories (#55)

This commit is contained in:
Vivian Phung 2024-05-14 19:12:57 -04:00 committed by GitHub
commit 6975360d48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,7 +17,10 @@ const meta: Meta<typeof Switch> = {
control: 'object', control: 'object',
}, },
onCheckedChange: { onCheckedChange: {
action: 'onCheckedChange', action: 'checkedChange',
},
fullWidth: {
control: 'boolean',
}, },
}, },
}; };
@ -26,26 +29,65 @@ export default meta;
type Story = StoryObj<typeof Switch>; type Story = StoryObj<typeof Switch>;
export const Default: Story = { export const Default: Story = {};
render: ({ label, description, wrapperProps, onCheckedChange }) => (
<Switch
label={label}
description={description}
wrapperProps={wrapperProps}
checked={false}
onCheckedChange={onCheckedChange}
/>
),
};
export const Checked: Story = { export const Checked: Story = {
render: ({ label, description, wrapperProps, onCheckedChange }) => ( args: {
<Switch checked: true,
label={label} },
description={description} };
wrapperProps={wrapperProps}
checked={true} export const Disabled: Story = {
onCheckedChange={onCheckedChange} args: {
/> disabled: true,
), },
};
export const WithLabel: Story = {
args: {
label: 'Label',
},
};
export const WithDescription: Story = {
args: {
description: 'Description',
},
};
export const WithWrapperProps: Story = {
args: {
wrapperProps: {
style: {
border: '1px solid red',
},
},
},
};
export const WithLabelAndDescription: Story = {
args: {
label: 'Label',
description: 'Description',
},
};
export const WithLabelAndDescriptionAndWrapperProps: Story = {
args: {
label: 'Label',
description: 'Description',
wrapperProps: {
style: {
border: '1px solid red',
},
},
},
};
export const FullWidthWithLabelAndDescription: Story = {
args: {
fullWidth: true,
label: 'Label',
description: 'Description',
},
}; };