diff --git a/storybook/stories/Button.stories.tsx b/storybook/stories/Button.stories.tsx index e69de29..22ff16e 100644 --- a/storybook/stories/Button.stories.tsx +++ b/storybook/stories/Button.stories.tsx @@ -0,0 +1,76 @@ +import React from 'react' + +import Button from '@/button' +import {iconNames} from '@/icon' +import { Meta, StoryFn } from '@storybook/react' + +const meta: Meta = { + title: 'Components/Button', + component: Button, + argTypes: { + mode: { + control: { type: 'select' }, + options: ['primary', 'secondary', 'outline', 'link'], + description: 'Visual style of the button', + table: { + defaultValue: { + summary: 'primary' + }, + type: { + summary: '"primary", "secondary", "outline", "link"' + } + } + }, + size: { + control: { type: 'inline-radio' }, + options: ['small', 'medium'] + }, + variant: { + control: { type: 'select' }, + options: ['positive', 'negative', 'neutral'] + }, + icon: { + control: { type: 'select' }, + options: Object.keys(iconNames).map((name) => name) + }, + loading: { + control: { type: 'boolean' } + }, + content: { + control: { type: 'text' } + } + } +} + +export default meta + +type ButtonProps = React.ComponentProps + +const Template: StoryFn = (args: ButtonProps) => + +export const Primary = Template.bind({}) +Primary.args = { + mode: 'primary', + size: 'medium' +} + +export const Secondary = Template.bind({}) +Secondary.args = { + mode: 'secondary', + size: 'medium' +} + +export const WithIcon = Template.bind({}) +WithIcon.args = { + mode: 'primary', + icon: 'Camera', + size: 'medium' +} + +export const Loading = Template.bind({}) +Loading.args = { + mode: 'primary', + size: 'medium', + loading: true, + content: 'Loading...' +} diff --git a/storybook/stories/Icon.stories.tsx b/storybook/stories/Icon.stories.tsx index e69de29..d406dba 100644 --- a/storybook/stories/Icon.stories.tsx +++ b/storybook/stories/Icon.stories.tsx @@ -0,0 +1,25 @@ +import React from 'react' + +import Icon, { iconNames, IconTypes } from '@/icon' +import { Meta, StoryFn } from '@storybook/react' + +export default { + title: 'Components/Icon', + component: Icon +} as Meta + +export const AllIcons: StoryFn = () => ( +
+ {Object.keys(iconNames).map((name) => ( +
+ +
+ ))} +
+)