mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 20:39:08 +01:00
c5368c152b
* added storybook test runner * added test runner in ci * updated test for ci and fixed lint error * updated lavamoat policy * updated test command * updated playwright * changed command to storybook;ci * updated command * updated instance for test-storybook * updated playwright * added playwright step * replaced concurrently with start-server-and-test * updated the static storybook directory * replaced first with last * updated lock file * replaced first with last * updated test-storybook with maxworkers * updated .depchechrc * updated yml * removed id from banner base * replaced broken stories with .stories-to-do.js extesnsion * updated token allowance story * removed duplicacies from yarn * fixed lavamoat * removed filename comment * updated links for docs * fixed file extension for stories * updated path for stories.json * updated stories.json path * yarn updated * updated stories * updated yarn * updated wait on
156 lines
3.3 KiB
JavaScript
156 lines
3.3 KiB
JavaScript
import React from 'react';
|
|
import {
|
|
ALIGN_ITEMS,
|
|
DISPLAY,
|
|
SIZES,
|
|
TEXT,
|
|
} 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',
|
|
},
|
|
icon: {
|
|
control: 'select',
|
|
options: Object.values(ICON_NAMES),
|
|
table: { category: 'button base props' },
|
|
},
|
|
iconPositionRight: {
|
|
control: 'boolean',
|
|
table: { category: 'button base props' },
|
|
},
|
|
iconProps: {
|
|
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) => <ButtonLink {...args} />;
|
|
|
|
DefaultStory.storyName = 'Default';
|
|
|
|
export const Size = (args) => (
|
|
<>
|
|
<Box display={DISPLAY.FLEX} alignItems={ALIGN_ITEMS.BASELINE} gap={1}>
|
|
<ButtonLink {...args} size={SIZES.SM}>
|
|
Small Button
|
|
</ButtonLink>
|
|
<ButtonLink {...args} size={SIZES.MD}>
|
|
Medium (Default) Button
|
|
</ButtonLink>
|
|
<ButtonLink {...args} size={SIZES.LG}>
|
|
Large Button
|
|
</ButtonLink>
|
|
</Box>
|
|
<Text variant={TEXT.BODY_MD}>
|
|
<ButtonLink {...args} size={SIZES.AUTO}>
|
|
Button Auto
|
|
</ButtonLink>{' '}
|
|
inherits the font-size of the parent element.
|
|
</Text>
|
|
</>
|
|
);
|
|
|
|
export const Danger = (args) => (
|
|
<Box display={DISPLAY.FLEX} gap={1}>
|
|
<ButtonLink {...args}>Normal</ButtonLink>
|
|
{/* Test Anchor tag to match exactly as button */}
|
|
<ButtonLink as="a" {...args} href="#" danger>
|
|
Danger
|
|
</ButtonLink>
|
|
</Box>
|
|
);
|
|
|
|
export const Href = (args) => <ButtonLink {...args}>Anchor Element</ButtonLink>;
|
|
|
|
Href.args = {
|
|
href: '/metamask',
|
|
};
|