feat: add basis of toggle atom

This commit is contained in:
41666 2021-04-22 16:26:23 -04:00
parent 3172870aaf
commit 8b8f053525
4 changed files with 39 additions and 0 deletions

View 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>
);
};