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 (#17092)
* 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

186 lines
4.2 KiB
JavaScript

import React from 'react';
import {
SIZES,
DISPLAY,
ALIGN_ITEMS,
COLORS,
BACKGROUND_COLORS,
} from '../../../helpers/constants/design-system';
import Box from '../../ui/box/box';
import { ICON_NAMES } from '..';
import README from './README.mdx';
import { AvatarIcon, AVATAR_ICON_SIZES } from '.';
const marginSizeControlOptions = [
undefined,
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
'auto',
];
export default {
title: 'Components/ComponentLibrary/AvatarIcon',
component: AvatarIcon,
parameters: {
docs: {
page: README,
},
},
argTypes: {
iconName: {
options: Object.values(ICON_NAMES),
control: 'select',
},
size: {
control: 'select',
options: Object.values(AVATAR_ICON_SIZES),
},
backgroundColor: {
control: 'select',
options: Object.values(BACKGROUND_COLORS),
},
color: {
control: 'select',
options: Object.values(COLORS),
},
className: {
control: 'text',
},
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: {
size: SIZES.MD,
},
};
const Template = (args) => {
return <AvatarIcon iconName={ICON_NAMES.SWAP_HORIZONTAL_OUTLINE} {...args} />;
};
export const DefaultStory = Template.bind({});
DefaultStory.storyName = 'Default';
export const Size = (args) => (
<Box display={DISPLAY.FLEX} alignItems={ALIGN_ITEMS.BASELINE} gap={1}>
<AvatarIcon {...args} size={SIZES.XS} />
<AvatarIcon {...args} size={SIZES.SM} />
<AvatarIcon {...args} size={SIZES.MD} />
<AvatarIcon {...args} size={SIZES.LG} />
<AvatarIcon {...args} size={SIZES.XL} />
</Box>
);
Size.args = {
iconName: ICON_NAMES.CHECK_CIRCLE_ON_FILLED,
};
export const IconName = (args) => (
<Box display={DISPLAY.FLEX} gap={1}>
<AvatarIcon
color={COLORS.PRIMARY_DEFAULT}
backgroundColor={BACKGROUND_COLORS.PRIMARY_MUTED}
iconName={ICON_NAMES.SWAP_HORIZONTAL_OUTLINE}
{...args}
/>
<AvatarIcon
color={COLORS.SUCCESS_DEFAULT}
backgroundColor={BACKGROUND_COLORS.SUCCESS_MUTED}
iconName={ICON_NAMES.CHECK_CIRCLE_ON_FILLED}
{...args}
/>
<AvatarIcon
color={COLORS.INFO_DEFAULT}
backgroundColor={BACKGROUND_COLORS.INFO_MUTED}
iconName={ICON_NAMES.INFO_FILLED}
{...args}
/>
<AvatarIcon
color={COLORS.WARNING_DEFAULT}
backgroundColor={BACKGROUND_COLORS.WARNING_MUTED}
iconName={ICON_NAMES.WARNING_FILLED}
{...args}
/>
<AvatarIcon
color={COLORS.ERROR_DEFAULT}
backgroundColor={BACKGROUND_COLORS.ERROR_MUTED}
iconName={ICON_NAMES.DANGER_FILLED}
{...args}
/>
</Box>
);
export const ColorAndBackgroundColor = (args) => (
<Box display={DISPLAY.FLEX} gap={1}>
<AvatarIcon
color={COLORS.PRIMARY_DEFAULT}
backgroundColor={BACKGROUND_COLORS.PRIMARY_MUTED}
iconName={ICON_NAMES.SWAP_HORIZONTAL_OUTLINE}
{...args}
/>
<AvatarIcon
color={COLORS.PRIMARY_INVERSE}
backgroundColor={BACKGROUND_COLORS.PRIMARY_DEFAULT}
iconName={ICON_NAMES.SWAP_HORIZONTAL_OUTLINE}
{...args}
/>
<AvatarIcon
color={COLORS.SUCCESS_DEFAULT}
backgroundColor={BACKGROUND_COLORS.SUCCESS_MUTED}
iconName={ICON_NAMES.CHECK_CIRCLE_ON_FILLED}
{...args}
/>
<AvatarIcon
color={COLORS.INFO_DEFAULT}
backgroundColor={BACKGROUND_COLORS.INFO_MUTED}
iconName={ICON_NAMES.INFO_FILLED}
{...args}
/>
<AvatarIcon
color={COLORS.WARNING_DEFAULT}
backgroundColor={BACKGROUND_COLORS.WARNING_MUTED}
iconName={ICON_NAMES.WARNING_FILLED}
{...args}
/>
<AvatarIcon
color={COLORS.ERROR_DEFAULT}
backgroundColor={BACKGROUND_COLORS.ERROR_MUTED}
iconName={ICON_NAMES.DANGER_FILLED}
{...args}
/>
</Box>
);