diff --git a/src/design-system/atoms/button/Button.stories.tsx b/src/design-system/atoms/button/Button.stories.tsx new file mode 100644 index 0000000..cb46e35 --- /dev/null +++ b/src/design-system/atoms/button/Button.stories.tsx @@ -0,0 +1,25 @@ +import * as React from 'react'; +import { Button as ButtonComponent } from './Button'; + +export default { + title: 'Atoms/Button', + component: ButtonComponent, + argTypes: { + content: { control: 'text' }, + }, + args: { + content: 'Press me!', + size: 'large', + }, +}; + +export const Large = ({ content, ...args }) => ( + {content} +); + +export const Small = ({ content, ...args }) => ( + {content} +); +Small.args = { + size: 'small', +}; diff --git a/src/design-system/atoms/button/Button.story.tsx b/src/design-system/atoms/button/Button.story.tsx deleted file mode 100644 index 8004f69..0000000 --- a/src/design-system/atoms/button/Button.story.tsx +++ /dev/null @@ -1,83 +0,0 @@ -// TODO: port to new story - -import * as React from 'react'; -import { atomStories } from 'atoms/atoms.story'; -import { Button, ButtonProps } from './Button'; -import { text as textKnob } from '@storybook/addon-knobs'; -import { FaDiscord } from 'react-icons/fa'; -import { styled } from '@storybook/theming'; - -const largeStory = atomStories('Button/Large', module); -const smallStory = atomStories('Button/Small', module); - -const colorModes: NonNullable[] = [ - 'primary', - 'secondary', - 'discord', - 'muted', -]; - -const Margin = styled.div` - margin-top: 5px; - display: flex; - align-items: center; -`; - -const storyTemplate = (props: Omit) => () => { - const text = textKnob('Button content', 'Example Button'); - - return ( - - {colorModes.map((color, i) => ( - - - {text} - - - {color[0].toUpperCase()} - {color.slice(1)} - - - ))} - - ); -}; -const storyBuilder = ( - story: typeof largeStory, - size: NonNullable -) => { - story.add( - 'Normal', - storyTemplate({ - size, - }) - ); - - story.add( - 'Icon', - storyTemplate({ - size, - icon: ( - - - - ), - }) - ); - - story.add( - 'Loading', - storyTemplate({ - size, - icon: ( - - - - ), - loading: true, - }) - ); -}; - -storyBuilder(largeStory, 'large'); -storyBuilder(smallStory, 'small'); diff --git a/src/design-system/atoms/button/Button.tsx b/src/design-system/atoms/button/Button.tsx index 69ef82b..9f8d9f4 100644 --- a/src/design-system/atoms/button/Button.tsx +++ b/src/design-system/atoms/button/Button.tsx @@ -10,6 +10,7 @@ export type ButtonProps = Partial & { icon?: React.ReactNode; loading?: boolean; onClick?: () => void; + disabled?: boolean; }; export const Button = (props: ButtonProps) => { @@ -28,6 +29,7 @@ export const Button = (props: ButtonProps) => { color={props.color || 'primary'} modifiers={modifiers} onClick={props.onClick} + disabled={props.disabled} > {props.icon && {props.icon}} {props.children}