import React from 'react';
import {
AlignItems,
Color,
DISPLAY,
FLEX_DIRECTION,
Size,
} from '../../../helpers/constants/design-system';
import Box from '../../ui/box/box';
import { TextDirection, IconName } from '..';
import { BUTTON_BASE_SIZES } from './button-base.constants';
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(BUTTON_BASE_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 Base',
},
};
export const DefaultStory = (args) => ;
DefaultStory.storyName = 'Default';
export const SizeStory = (args) => (
<>
Button SM
Button MD
Button LG
>
);
SizeStory.storyName = 'Size';
export const Block = (args) => (
<>
Default Button
Block Button
>
);
export const As = (args) => (
Button Element
Anchor Element
);
export const Href = (args) => Anchor Element;
Href.args = {
href: '/metamask',
};
export const ExternalLink = (args) => (
Anchor element with external link
);
ExternalLink.args = {
href: 'https://metamask.io',
externalLink: true,
};
export const Disabled = (args) => (
Disabled Button
);
Disabled.args = {
disabled: true,
};
export const Loading = (args) => (
Loading Button
);
Loading.args = {
loading: true,
};
export const StartIconName = (args) => (
Button
);
export const EndIconName = (args) => (
Button
);
export const Rtl = (args) => (
Button Demo
Button Demo
);
export const Ellipsis = (args) => (
Example without ellipsis
Example with ellipsis
);