import type { Meta, StoryObj } from '@storybook/react' import { SvgAdd1 } from '@chainlink/blocks-icons' import type { ButtonVariant, ButtonSize, ButtonWidth } from './Button' import { buttonVariants, visualVariants, sizeVariants, widthVariants, } from './Button' import { Button } from './Button' const BUTTON_VARIANT_OPTIONS = Object.keys(visualVariants) as ButtonVariant[] const BUTTON_SIZE_OPTIONS = Object.keys(sizeVariants).filter( (value): value is ButtonSize => value !== 'none', ) const BUTTON_WIDTH_OPTIONS = Object.keys(widthVariants) as ButtonWidth[] const meta = { title: 'Blocks/Button', component: Button, argTypes: { variant: { control: { type: 'select', }, options: [...BUTTON_VARIANT_OPTIONS], table: { type: { summary: BUTTON_VARIANT_OPTIONS.map((value) => `'${value}'`).join( ' | ', ), }, defaultValue: { summary: 'primary' }, }, }, size: { control: { type: 'select', }, options: BUTTON_SIZE_OPTIONS, table: { type: { summary: BUTTON_SIZE_OPTIONS.map((value) => `'${value}'`).join(' | '), }, defaultValue: { summary: 'default' }, }, }, width: { control: { type: 'select', }, options: [...BUTTON_WIDTH_OPTIONS], table: { type: { summary: BUTTON_WIDTH_OPTIONS.map((value) => `'${value}'`).join( ' | ', ), }, defaultValue: { summary: 'responsive' }, }, }, children: { control: 'text', table: { type: { summary: 'string | React.ReactNode' }, }, }, disabled: { control: 'boolean', table: { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, }, }, loading: { control: 'boolean', table: { type: { summary: 'boolean' }, defaultValue: { summary: 'false' }, }, }, }, } satisfies Meta export default meta type Story = StoryObj export const Default: Story = { args: { children: 'Button', }, } export const WithIcon: Story = { render: (args) => ( ), } export const Primary: Story = { render: (args) => (
), } export const Secondary: Story = { render: (args) => (
), args: { variant: 'secondary' }, } export const Tertiary: Story = { render: (args) => (
), args: { variant: 'tertiary' }, } export const Destructive: Story = { render: (_args) => (
), parameters: { docs: { description: { story: 'Use the destructive variant for irreversible or high-risk actions, usually after a confirmation step.', }, }, }, } export const Ghost: Story = { render: (args) => (
), args: { variant: 'ghost' }, } export const Widths: Story = { render: (args) => (
), } export const StyledLinkWithButtonVariants: Story = { render: (_args) => ( Visit example ), }