import React from 'react'; import { AlignItems, DISPLAY, FLEX_DIRECTION, Size, TextVariant, } from '../../../helpers/constants/design-system'; import { IconName } from '..'; import { BUTTON_LINK_SIZES } from '../button-link/button-link.constants'; import Box from '../../ui/box/box'; import { Text } from '../text'; import README from './README.mdx'; import { Button, BUTTON_VARIANT } from '.'; const marginSizeControlOptions = [ undefined, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 'auto', ]; export default { title: 'Components/ComponentLibrary/Button', component: Button, parameters: { docs: { page: README, }, controls: { sort: 'alpha' }, }, argTypes: { as: { control: 'select', options: ['button', 'a'], }, block: { control: 'boolean', }, children: { control: 'text', }, className: { control: 'text', }, danger: { control: 'boolean', }, disabled: { control: 'boolean', }, href: { control: 'text', }, startIconName: { control: 'select', options: Object.values(IconName), }, endIconName: { control: 'select', options: Object.values(IconName), }, startIconProps: { control: 'object', }, endIconProps: { control: 'object', }, loading: { control: 'boolean', }, size: { control: 'select', options: Object.values(BUTTON_LINK_SIZES), }, variant: { options: Object.values(BUTTON_VARIANT), control: 'select', }, marginTop: { options: marginSizeControlOptions, control: 'select', table: { category: 'box props' }, }, marginRight: { options: marginSizeControlOptions, control: 'select', table: { category: 'box props' }, }, marginBottom: { options: marginSizeControlOptions, control: 'select', table: { category: 'box props' }, }, marginLeft: { options: marginSizeControlOptions, control: 'select', table: { category: 'box props' }, }, }, args: { children: 'Button', }, }; export const DefaultStory = (args) => ); export const SizeStory = (args) => ( <> {' '} inherits the font-size of the parent element. Inherit size only used for ButtonLink. ); SizeStory.storyName = 'Size'; export const Danger = (args) => ( {/* Test Anchor tag to match exactly as button */} ); export const Href = (args) => ; Href.args = { href: '/metamask', }; export const Block = (args) => ( <> ); export const As = (args) => ( ); export const Disabled = (args) => ; Disabled.args = { disabled: true, }; export const Loading = (args) => ; Loading.args = { loading: true, }; export const StartIconName = (args) => ( ); export const EndIconName = (args) => ( );