mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-05-07 01:02:36 +00:00
feat: add basis of toggle atom
This commit is contained in:
parent
3172870aaf
commit
8b8f053525
4 changed files with 39 additions and 0 deletions
23
packages/design-system/atoms/toggle/Toggle.stories.tsx
Normal file
23
packages/design-system/atoms/toggle/Toggle.stories.tsx
Normal file
|
@ -0,0 +1,23 @@
|
|||
import * as React from 'react';
|
||||
import { Toggle } from './Toggle';
|
||||
export default {
|
||||
title: 'Atoms/Toggle',
|
||||
component: Toggle,
|
||||
};
|
||||
|
||||
export const toggle = (args) => <Toggle {...args}>Turn a cool thing on</Toggle>;
|
||||
export const interactive = (args) => {
|
||||
const [state, setState] = React.useState(true);
|
||||
return (
|
||||
<Toggle
|
||||
{...args}
|
||||
state={state}
|
||||
onChange={(val) => {
|
||||
setState(val);
|
||||
args.onChange(val);
|
||||
}}
|
||||
>
|
||||
Turn a cool thing on
|
||||
</Toggle>
|
||||
);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue