-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Lock icon added for the disabled state, * Applied proper color tokens for `hover`, `enabled`, and `disabled` cases, * Changed naming convention as `enabled/disabled` was easy to be confused with `checked (on)/unchecked (off)`, * Added multiple stories representing the changes, * Used `--color-action-default-rgb` for `box-shadow` * Added `StoryDescriptor` component for wrapping components that require additional description
- Loading branch information
Szymon Graczyk
authored
Jul 26, 2022
1 parent
65e3c89
commit 6a0c3ca
Showing
12 changed files
with
149 additions
and
88 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
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
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
49 changes: 33 additions & 16 deletions
49
packages/react-components/src/components/Switch/Switch.stories.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,40 @@ | ||
import * as React from 'react'; | ||
import { ComponentMeta } from '@storybook/react'; | ||
import { ComponentMeta, Story } from '@storybook/react'; | ||
|
||
import { Switch as SwitchComponent, SwitchProps } from './Switch'; | ||
import noop from '../../utils/noop'; | ||
import { StoryDescriptor } from '../../stories/components/StoryDescriptor'; | ||
|
||
import { Switch, SwitchProps } from './Switch'; | ||
|
||
export default { | ||
title: 'Components/Switch', | ||
component: SwitchComponent, | ||
} as ComponentMeta<typeof SwitchComponent>; | ||
component: Switch, | ||
} as ComponentMeta<typeof Switch>; | ||
|
||
export const Default: Story<SwitchProps> = (args: SwitchProps) => ( | ||
<Switch {...args} onChange={undefined} /> | ||
); | ||
Default.storyName = 'Switch'; | ||
|
||
export const Switch = (args: SwitchProps): React.ReactElement => { | ||
return ( | ||
<div> | ||
<SwitchComponent {...args} /> | ||
</div> | ||
); | ||
}; | ||
export const States = (): JSX.Element => ( | ||
<> | ||
<StoryDescriptor title="Enabled"> | ||
<Switch on={true} /> | ||
<Switch on={false} /> | ||
</StoryDescriptor> | ||
<StoryDescriptor title="Disabled"> | ||
<Switch on={true} disabled={true} /> | ||
<Switch on={false} disabled={true} /> | ||
</StoryDescriptor> | ||
</> | ||
); | ||
|
||
Switch.args = { | ||
size: 'basic', | ||
onChange: noop, | ||
}; | ||
export const Sizes = (): JSX.Element => ( | ||
<> | ||
<StoryDescriptor title="Compact"> | ||
<Switch size="compact" /> | ||
</StoryDescriptor> | ||
<StoryDescriptor title="Basic"> | ||
<Switch size="basic" /> | ||
</StoryDescriptor> | ||
</> | ||
); |
Oops, something went wrong.