import React from 'react'; import { StoryFn, Meta } from '@storybook/react'; import { AlignItems, BackgroundColor, Display, FlexDirection, TextColor, } from '../../../helpers/constants/design-system'; import { Box, TextDirection, IconName } from '..'; import { ButtonBaseSize } from './button-base.types'; import { ButtonBase } from './button-base'; import README from './README.mdx'; const marginSizeControlOptions = [ undefined, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 'auto', ]; export default { title: 'Components/ComponentLibrary/ButtonBase', component: ButtonBase, parameters: { docs: { page: README, }, }, argTypes: { as: { control: 'select', options: ['button', 'a'], }, block: { control: 'boolean', }, children: { control: 'text', }, className: { control: 'text', }, disabled: { control: 'boolean', }, startIconName: { control: 'select', options: Object.values(IconName), }, endIconName: { control: 'select', options: Object.values(IconName), }, loading: { control: 'boolean', }, size: { control: 'select', options: Object.values(ButtonBaseSize), }, 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 Base', }, } as Meta; export const DefaultStory: StoryFn = (args) => ( ); DefaultStory.storyName = 'Default'; export const SizeStory: StoryFn = (args) => ( <> Button SM Button MD Button LG ); SizeStory.storyName = 'Size'; export const Block: StoryFn = (args) => ( <> Default Button Block Button ); export const As: StoryFn = (args) => ( Button Element Anchor Element ); export const Href: StoryFn = (args) => ( Anchor Element ); Href.args = { href: '/metamask', }; export const ExternalLink: StoryFn = (args) => ( Anchor element with external link ); ExternalLink.args = { href: 'https://metamask.io', externalLink: true, }; export const Disabled: StoryFn = (args) => ( Disabled Button ); Disabled.args = { disabled: true, }; export const Loading: StoryFn = (args) => ( Loading Button ); Loading.args = { loading: true, }; export const StartIconName: StoryFn = (args) => ( Button ); export const EndIconName: StoryFn = (args) => ( Button ); export const Rtl: StoryFn = (args) => ( Button Demo Button Demo ); export const Ellipsis: StoryFn = (args) => ( Example without ellipsis Example with ellipsis );