import React from 'react'; import { AlignItems, DISPLAY, FLEX_DIRECTION, Size, TextVariant, } from '../../../helpers/constants/design-system'; import { ICON_NAMES } from '../icon'; 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_TYPES } 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', }, iconName: { control: 'select', options: Object.values(ICON_NAMES), }, iconPositionRight: { control: 'boolean', }, iconProps: { control: 'object', }, loading: { control: 'boolean', }, size: { control: 'select', options: Object.values(BUTTON_LINK_SIZES), }, type: { options: Object.values(BUTTON_TYPES), 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 Icon = (args) => ( );