import React from 'react'; import { AlignItems, BorderColor, BorderStyle, DISPLAY, Size, TextVariant, TextColor, } from '../../../helpers/constants/design-system'; import Box from '../../ui/box/box'; import { ICON_NAMES } from '../icon'; import { Text } from '../text'; import { ButtonLink } from './button-link'; import { BUTTON_LINK_SIZES } from './button-link.constants'; 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/ButtonLink', component: ButtonLink, parameters: { docs: { page: README, }, }, argTypes: { as: { control: 'select', options: ['button', 'a'], table: { category: 'button base props' }, }, block: { control: 'boolean', table: { category: 'button base props' }, }, children: { control: 'text', }, className: { control: 'text', }, danger: { control: 'boolean', }, disabled: { control: 'boolean', table: { category: 'button base props' }, }, href: { control: 'text', }, startIconName: { control: 'select', options: Object.values(ICON_NAMES), table: { category: 'button base props' }, }, endIconName: { control: 'select', options: Object.values(ICON_NAMES), table: { category: 'button base props' }, }, startIconProps: { control: 'object', table: { category: 'button base props' }, }, endIconProps: { control: 'object', table: { category: 'button base props' }, }, loading: { control: 'boolean', table: { category: 'button base props' }, }, size: { control: 'select', options: Object.values(BUTTON_LINK_SIZES), }, 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 Link', }, }; export const DefaultStory = (args) => ; DefaultStory.storyName = 'Default'; export const SizeStory = (args) => ( <> Auto (default) Small Medium Large Inherits the font-size of the parent element.{' '} Learn more Inherits the font-size of the parent element.{' '} Learn more Inherits the font-size of the parent element.{' '} Learn more Inherits the font-size of the parent element and example with textProps override for a success color.{' '} Learn more ); SizeStory.storyName = 'Size'; export const Danger = (args) => ( Normal {/* Test Anchor tag to match exactly as button */} Danger ); export const Href = (args) => Href example; Href.args = { href: '/metamask', }; export const HitArea = (args) => ( <> Default Auto (default) Small Medium Large Add paddingLeft and paddingRight props Auto (default) Small Medium Large Add block prop Large block ); HitArea.args = { borderColor: BorderColor.errorDefault, borderStyle: BorderStyle.dashed, };