-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from Dias999/feature/Storybook-Checkbox
feat: storybook / tsdocs - Checkbox
- Loading branch information
Showing
8 changed files
with
124 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default } from './Checkbox'; | ||
export { Checkbox, CheckboxProps } from './Checkbox'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/react-material-ui/src/styles/CustomWidgets/CustomCheckboxWidget.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/react-material-ui/src/styles/CustomWidgets/CustomCheckboxesWidget.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import React, { useState } from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { Checkbox } from '@concepta/react-material-ui'; | ||
|
||
const meta = { | ||
component: Checkbox, | ||
tags: ['autodocs'], | ||
args: {}, | ||
argTypes: { | ||
label: { control: 'text' }, | ||
onChange: { action: 'changed' }, | ||
textProps: { control: 'object' }, | ||
}, | ||
render: (args) => { | ||
const [checked, setChecked] = useState(args.checked); | ||
return ( | ||
<Checkbox | ||
{...args} | ||
checked={checked} | ||
onChange={(e) => setChecked(e.target.checked)} | ||
/> | ||
); | ||
}, | ||
} satisfies Meta<typeof Checkbox>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: {}, | ||
}; | ||
|
||
export const WithLabel: Story = { | ||
args: { | ||
label: 'Checkbox Label', | ||
}, | ||
}; | ||
|
||
export const Checked: Story = { | ||
args: { | ||
checked: true, | ||
label: 'Checked Checkbox', | ||
}, | ||
}; | ||
|
||
export const Disabled: Story = { | ||
args: { | ||
disabled: true, | ||
label: 'Disabled Checkbox', | ||
}, | ||
}; | ||
|
||
export const Required: Story = { | ||
args: { | ||
required: true, | ||
label: 'Required Checkbox', | ||
}, | ||
}; | ||
|
||
export const CustomTextProperties: Story = { | ||
args: { | ||
label: 'Custom Text Properties', | ||
textProps: { | ||
fontSize: 20, | ||
fontWeight: 700, | ||
color: 'secondary.main', | ||
}, | ||
}, | ||
}; | ||
|
||
export const CustomStylesWithSx: Story = { | ||
args: { | ||
label: 'Custom Styles with sx', | ||
sx: { | ||
border: '1px solid red', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters