import type { Meta, StoryObj } from '@storybook/react' import { fn } from '@storybook/test' import { MaterialIcon } from '../Icons/MaterialIcon' import { config as typographyConfig } from '../Typography/variants' import { Button } from './Button' import { config as buttonConfig } from './variants' const meta: Meta = { title: 'Components/Button', component: Button, argTypes: { onPress: { table: { disable: true, }, }, typography: { control: 'select', options: Object.keys(typographyConfig.variants.variant), }, variant: { control: 'select', options: Object.keys(buttonConfig.variants.variant), default: 'Primary', }, color: { control: 'select', options: Object.keys(buttonConfig.variants.color), type: 'string', description: 'The color variant, only applies to the variants `Primary`, `Secondary` and `Text`. Defaults to `Primary`.', }, size: { control: 'select', options: Object.keys(buttonConfig.variants.size), type: 'string', description: 'The size of the button. Defaults to `Large`.', }, wrapping: { control: 'radio', options: Object.keys(buttonConfig.variants.wrapping), type: 'boolean', description: 'Only applies to variant `Text`. If `true`, the button will keep the default padding set on the buttons. Defaults to `true`.', }, }, } export default meta type Story = StoryObj export const PrimaryDefault: Story = { args: { onPress: fn(), children: 'Primary button', typography: 'Body/Paragraph/mdBold', variant: 'Primary', }, } export const PrimaryDisabled: Story = { args: { ...PrimaryDefault.args, isDisabled: true, }, } export const PrimaryLarge: Story = { args: { ...PrimaryDefault.args, size: 'Large', }, } export const PrimaryMedium: Story = { args: { ...PrimaryDefault.args, size: 'Medium', }, } export const PrimarySmall: Story = { args: { ...PrimaryDefault.args, size: 'Small', }, } export const PrimaryInvertedDefault: Story = { args: { onPress: fn(), children: 'Primary inverted button', typography: 'Body/Paragraph/mdBold', variant: 'Primary', color: 'Inverted', }, } export const PrimaryInvertedDisabled: Story = { args: { ...PrimaryInvertedDefault.args, isDisabled: true, }, } export const PrimaryInvertedLarge: Story = { args: { ...PrimaryInvertedDefault.args, size: 'Large', }, } export const PrimaryInvertedMedium: Story = { args: { ...PrimaryInvertedDefault.args, size: 'Medium', }, } export const PrimaryInvertedSmall: Story = { args: { ...PrimaryInvertedDefault.args, size: 'Small', }, } export const SecondaryDefault: Story = { args: { onPress: fn(), children: 'Secondary button', typography: 'Body/Paragraph/mdBold', variant: 'Secondary', }, } export const SecondaryDisabled: Story = { args: { ...SecondaryDefault.args, isDisabled: true, }, } export const SecondaryLarge: Story = { args: { ...SecondaryDefault.args, size: 'Large', }, } export const SecondaryMedium: Story = { args: { ...SecondaryDefault.args, size: 'Medium', }, } export const SecondarySmall: Story = { args: { ...SecondaryDefault.args, size: 'Small', }, } export const SecondaryInvertedDefault: Story = { args: { onPress: fn(), children: 'Secondary inverted button', typography: 'Body/Paragraph/mdBold', variant: 'Secondary', color: 'Inverted', }, } export const SecondaryInvertedDisabled: Story = { args: { ...SecondaryInvertedDefault.args, isDisabled: true, }, } export const SecondaryInvertedLarge: Story = { args: { ...SecondaryInvertedDefault.args, size: 'Large', }, } export const SecondaryInvertedMedium: Story = { args: { ...SecondaryInvertedDefault.args, size: 'Medium', }, } export const SecondaryInvertedSmall: Story = { args: { ...SecondaryInvertedDefault.args, size: 'Small', }, } export const TertiaryDefault: Story = { args: { onPress: fn(), children: 'Tertiary button', typography: 'Body/Paragraph/mdBold', variant: 'Tertiary', }, } export const TertiaryDisabled: Story = { args: { ...TertiaryDefault.args, isDisabled: true, }, } export const TertiaryLarge: Story = { args: { ...TertiaryDefault.args, size: 'Large', }, } export const TertiaryMedium: Story = { args: { ...TertiaryDefault.args, size: 'Medium', }, } export const TertiarySmall: Story = { args: { ...TertiaryDefault.args, size: 'Small', }, } export const TextDefault: Story = { args: { onPress: fn(), children: 'Text button', typography: 'Body/Paragraph/mdBold', variant: 'Text', }, } export const TextDisabled: Story = { args: { ...TextDefault.args, isDisabled: true, }, } export const TextLarge: Story = { args: { ...TextDefault.args, size: 'Large', }, } export const TextMedium: Story = { args: { ...TextDefault.args, size: 'Medium', }, } export const TextSmall: Story = { args: { ...TextDefault.args, size: 'Small', }, } export const TextNoWrapping: Story = { args: { ...TextDefault.args, children: 'Text button with wrapping false', wrapping: false, }, } export const TextInvertedDefault: Story = { args: { onPress: fn(), children: 'Text inverted button', typography: 'Body/Paragraph/mdBold', variant: 'Text', color: 'Inverted', }, } export const TextInvertedDisabled: Story = { args: { ...TextInvertedDefault.args, isDisabled: true, }, } export const TextInvertedLarge: Story = { args: { ...TextInvertedDefault.args, size: 'Large', }, } export const TextInvertedMedium: Story = { args: { ...TextInvertedDefault.args, size: 'Medium', }, } export const TextInvertedSmall: Story = { args: { ...TextInvertedDefault.args, size: 'Small', }, } export const TextWithIcon: Story = { args: { onPress: fn(), children: ( <> Text with icon ), typography: 'Body/Paragraph/mdBold', variant: 'Text', }, } export const TextWithIconInverted: Story = { args: { onPress: fn(), children: ( <> Text with icon ), typography: 'Body/Paragraph/mdBold', variant: 'Text', color: 'Inverted', }, }