1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00
metamask-extension/ui/components/component-library/avatar-base/avatar-base.stories.tsx
George Marshall 5d17f86e02
Update Text import paths: component library/ (#19987)
* Updating component-librar import paths

* Updating snapshots

* Updates to AvatarBase story

* Updates to avatar and checkbox

* Updating last of the deprecated import paths

* Updating component-library snapshots from button-base

* Updating snapshots from rest of codebase to do with button-base

* Removing unneeded CSS

* Updating snapshots
2023-07-17 14:00:16 -07:00

157 lines
3.6 KiB
TypeScript

import { Meta, StoryFn } from '@storybook/react';
import React from 'react';
import {
AlignItems,
Display,
TextColor,
BackgroundColor,
BorderColor,
IconColor,
} from '../../../helpers/constants/design-system';
import { AvatarBase, Icon, IconName, Box } from '..';
import { AvatarBaseSize } from './avatar-base.types';
import README from './README.mdx';
const marginSizeKnobOptions = [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
'auto',
];
export default {
title: 'Components/ComponentLibrary/AvatarBase',
component: AvatarBase,
parameters: {
docs: {
page: README,
},
},
argTypes: {
size: {
control: 'select',
options: Object.values(AvatarBaseSize),
},
children: {
control: 'text',
},
color: {
options: Object.values(TextColor),
control: 'select',
},
backgroundColor: {
options: Object.values(BackgroundColor),
control: 'select',
},
borderColor: {
options: Object.values(BorderColor),
control: 'select',
},
display: {
options: Object.values(Display),
control: 'select',
table: { category: 'box props' },
},
marginTop: {
options: marginSizeKnobOptions,
control: 'select',
table: { category: 'box props' },
},
marginRight: {
options: marginSizeKnobOptions,
control: 'select',
table: { category: 'box props' },
},
marginBottom: {
options: marginSizeKnobOptions,
control: 'select',
table: { category: 'box props' },
},
marginLeft: {
options: marginSizeKnobOptions,
control: 'select',
table: { category: 'box props' },
},
},
args: {
size: AvatarBaseSize.Md,
color: TextColor.textDefault,
backgroundColor: BackgroundColor.backgroundAlternative,
borderColor: BorderColor.borderDefault,
children: 'B',
},
} as Meta<typeof AvatarBase>;
export const DefaultStory: StoryFn<typeof AvatarBase> = (args) => (
<AvatarBase {...args} />
);
DefaultStory.storyName = 'Default';
export const Size: StoryFn<typeof AvatarBase> = (args) => (
<Box display={Display.Flex} alignItems={AlignItems.baseline} gap={1}>
<AvatarBase {...args} size={AvatarBaseSize.Xs} />
<AvatarBase {...args} size={AvatarBaseSize.Sm} />
<AvatarBase {...args} size={AvatarBaseSize.Md} />
<AvatarBase {...args} size={AvatarBaseSize.Lg} />
<AvatarBase {...args} size={AvatarBaseSize.Xl} />
</Box>
);
export const Children: StoryFn<typeof AvatarBase> = (args) => (
<Box display={Display.Flex} gap={1}>
<AvatarBase {...args}>
<img src="./images/eth_logo.png" />
</AvatarBase>
<AvatarBase {...args}>
<img width="100%" src="./images/arbitrum.svg" />
</AvatarBase>
<AvatarBase {...args}>
<img width="100%" src="./images/avax-token.png" />
</AvatarBase>
<AvatarBase {...args}>A</AvatarBase>
<AvatarBase
{...args}
backgroundColor={BackgroundColor.infoMuted}
borderColor={BorderColor.infoMuted}
>
<Icon name={IconName.User} color={IconColor.infoDefault} />
</AvatarBase>
</Box>
);
export const ColorBackgroundColorAndBorderColor: StoryFn<typeof AvatarBase> = (
args,
) => (
<Box display={Display.Flex} gap={1}>
<AvatarBase {...args}>B</AvatarBase>
<AvatarBase
{...args}
backgroundColor={BackgroundColor.goerli}
borderColor={BorderColor.goerli}
color={TextColor.primaryInverse}
>
G
</AvatarBase>
<AvatarBase
{...args}
backgroundColor={BackgroundColor.sepolia}
borderColor={BorderColor.sepolia}
color={TextColor.primaryInverse}
>
S
</AvatarBase>
</Box>
);