import React from 'react'; import { Table, TableHead, TableRow, TableBody, TableCell } from '@mui/material'; import { action } from 'storybook/actions'; import Button from '@/components/Button'; import type { StoryFn, Meta } from '@storybook/react-webpack5'; export default { title: 'Components/Button', component: Button, args: { kind: 'contained', children: 'Text', disabled: false, size: 'small', onClick: () => { action('onClick')(); console.log('onClick'); }, }, argTypes: { children: { type: 'string', }, disabled: { control: { type: 'boolean', }, table: { defaultValue: { summary: 'false' }, }, }, size: { control: { type: 'radio', }, options: ['small', 'medium', 'large'], table: { defaultValue: { summary: 'small' }, }, }, onClick: { type: 'function', control: { type: 'radio', }, options: ['function', undefined], mapping: { function: action('onClick'), undefined: undefined, }, description: 'It is a callback function that is called when the button is clicked.', }, kind: { control: false, options: ['contained', 'outlined', 'ghost'], description: 'Button has three Kinds Contained, Outlined, Ghost', table: { defaultValue: { summary: 'contained' }, }, }, variant: { control: { type: 'radio', }, options: ['contained', 'outlined', 'text', 'ghost'], description: 'The variant is alias of kind.', table: { defaultValue: { summary: 'contained' }, }, }, }, parameters: { controls: { include: ['onClick', 'children', 'color', 'size', 'disabled', 'kind', 'variant'], }, pseudo: { hover: ['#hover1', '#hover2', '#hover3', '#hover4', '#hover5', '#hover6', '#hover7'], }, docs: { description: { component: `It is a kind Button docs. For more details, please see [Material-UI Button](https://mui.com/material-ui/react-button/).`, }, }, }, } as Meta; const ButtonTemplate: StoryFn = ({ color, children, ...restProps }) => { // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars const { variant, kind, ...restArgs } = restProps; return ( <> ); }; export const Kind = { render: ButtonTemplate, }; const ContainedButtonTemplate: StoryFn = (args) => { // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars const { variant, ...restProps } = args; return ( <> Contained Primary Contained Secondary Contained Error Enable Hover Focus Disabled
); }; export const KindContained = { render: ContainedButtonTemplate, argTypes: { color: { control: 'false', options: ['primary', 'secondary', 'error'], defaultValue: 'primary', description: `The color of the component. \n It supports both default and custom theme colors, \n which can be added as shown in the palette customization guide.`, table: { defaultValue: { summary: 'primary' }, }, }, }, name: 'Kind: Contained', }; const GhostButtonTemplate: StoryFn = (args) => { // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars const { variant, ...restProps } = args; return ( <> Ghost Primary Ghost Secondary Ghost Error Enable Hover Focus Disabled


); }; export const KindGhost = { render: GhostButtonTemplate, argTypes: { color: { control: 'false', options: ['primary', 'secondary', 'error'], description: `The color of the component. \n It supports both default and custom theme colors, \n which can be added as shown in the palette customization guide.`, defaultValue: 'primary', table: { defaultValue: { summary: 'primary' }, }, }, }, name: 'Kind: Ghost', }; const OutlinedButtonTemplate: StoryFn = (args) => { // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars const { variant, kind, color, ...restProps } = args; return ( <> Outlined Primary Outlined Secondary Enable Hover Focus Disabled
); }; export const KindOutlined = { render: OutlinedButtonTemplate, argTypes: { color: { control: 'false', options: ['primary'], defaultValue: 'primary', description: `The color of the component. \n It supports both default and custom theme colors, \n which can be added as shown in the palette customization guide.`, table: { type: { summary: 'primary' }, defaultValue: { summary: 'primary' }, }, }, }, name: 'Kind: Outlined', };