1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
Nidhi Kumari c5368c152b
Added storybook check to CI ()
* 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
2023-01-21 00:57:46 +05:30

196 lines
3.7 KiB
JavaScript

import React from 'react';
import {
ALIGN_ITEMS,
COLORS,
DISPLAY,
FLEX_DIRECTION,
SIZES,
} from '../../../helpers/constants/design-system';
import Box from '../../ui/box/box';
import { ICON_NAMES } from '../icon';
import { BUTTON_ICON_SIZES } from './button-icon.constants';
import { ButtonIcon } from './button-icon';
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/ButtonIcon',
component: ButtonIcon,
parameters: {
docs: {
page: README,
},
},
argTypes: {
ariaLabel: {
control: 'text',
},
as: {
control: 'select',
options: ['button', 'a'],
},
className: {
control: 'text',
},
color: {
control: 'select',
options: Object.values(COLORS),
},
disabled: {
control: 'boolean',
},
href: {
control: 'text',
},
iconName: {
control: 'select',
options: Object.values(ICON_NAMES),
},
size: {
control: 'select',
options: Object.values(BUTTON_ICON_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' },
},
},
};
export const DefaultStory = (args) => <ButtonIcon {...args} />;
DefaultStory.args = {
iconName: ICON_NAMES.CLOSE_OUTLINE,
ariaLabel: 'Close',
};
DefaultStory.storyName = 'Default';
export const IconName = (args) => <ButtonIcon {...args} />;
IconName.args = {
iconName: ICON_NAMES.CLOSE_OUTLINE,
ariaLabel: 'Close',
};
export const Size = (args) => (
<Box
display={DISPLAY.FLEX}
alignItems={ALIGN_ITEMS.BASELINE}
gap={1}
marginBottom={2}
>
<ButtonIcon
{...args}
size={SIZES.SM}
iconName={ICON_NAMES.CLOSE_OUTLINE}
ariaLabel="Close"
/>
<ButtonIcon
{...args}
size={SIZES.LG}
color={COLORS.PRIMARY}
iconName={ICON_NAMES.CLOSE_OUTLINE}
ariaLabel="Close"
/>
</Box>
);
export const AriaLabel = (args) => (
<>
<ButtonIcon
as="button"
iconName={ICON_NAMES.CLOSE_OUTLINE}
ariaLabel="Close"
{...args}
/>
<ButtonIcon
as="a"
href="https://metamask.io/"
target="_blank"
color={COLORS.PRIMARY_DEFAULT}
iconName={ICON_NAMES.EXPORT}
ariaLabel="Visit MetaMask.io"
{...args}
/>
</>
);
export const As = (args) => (
<Box display={DISPLAY.FLEX} flexDirection={FLEX_DIRECTION.ROW} gap={2}>
<ButtonIcon
{...args}
iconName={ICON_NAMES.CLOSE_OUTLINE}
ariaLabel="close"
/>
<ButtonIcon
as="a"
href="#"
{...args}
color={COLORS.PRIMARY_DEFAULT}
iconName={ICON_NAMES.EXPORT}
ariaLabel="demo"
/>
</Box>
);
export const Href = (args) => (
<ButtonIcon iconName={ICON_NAMES.EXPORT} {...args} target="_blank" />
);
Href.args = {
ariaLabel: 'Visit Metamask.io',
href: 'https://metamask.io/',
color: COLORS.PRIMARY_DEFAULT,
};
export const Color = (args) => (
<ButtonIcon {...args} iconName={ICON_NAMES.CLOSE_OUTLINE} ariaLabel="close" />
);
Color.args = {
color: COLORS.PRIMARY_DEFAULT,
};
export const Disabled = (args) => (
<ButtonIcon {...args} iconName={ICON_NAMES.CLOSE_OUTLINE} ariaLabel="close" />
);
Disabled.args = {
disabled: true,
};