-
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 #173 from Dias999/feature/Storybook-Switch
feat: storybook / tsdocs - Switch
- Loading branch information
Showing
6 changed files
with
107 additions
and
9 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 './Switch'; | ||
export { Switch, SwitchProps } from './Switch'; |
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/CustomSwitchWidget.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,67 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { fn } from '@storybook/test'; | ||
|
||
import { Switch } from '@concepta/react-material-ui'; | ||
|
||
const meta = { | ||
component: Switch, | ||
tags: ['autodocs'], | ||
args: {}, | ||
argTypes: { | ||
label: { control: 'text' }, | ||
onChange: { action: 'changed' }, | ||
}, | ||
} satisfies Meta<typeof Switch>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: {}, | ||
}; | ||
|
||
export const WithLabel: Story = { | ||
args: { | ||
label: 'Switch Label', | ||
}, | ||
}; | ||
|
||
export const CustomLabelStyles: Story = { | ||
args: { | ||
label: 'Custom Styled Label', | ||
textProps: { | ||
fontSize: 18, | ||
fontWeight: 600, | ||
color: 'secondary.main', | ||
}, | ||
}, | ||
}; | ||
|
||
export const Checked: Story = { | ||
args: { | ||
checked: true, | ||
}, | ||
}; | ||
|
||
export const Disabled: Story = { | ||
args: { | ||
disabled: true, | ||
}, | ||
}; | ||
|
||
export const Required: Story = { | ||
args: { | ||
label: 'Required Switch', | ||
required: true, | ||
}, | ||
}; | ||
|
||
/** | ||
* Check the actions tab | ||
*/ | ||
export const OnChangeCallback: Story = { | ||
args: { | ||
onChange: fn(), | ||
}, | ||
}; |