1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-02 14:15:06 +01:00
metamask-extension/ui/components/component-library/avatar-network/avatar-network.stories.js
Nidhi Kumari 4fcbaae32f
housekeeping for avatar network (#16663)
* added housekeeping for avatar network

* fixed alt

* updated story in Readme

* fixed indentation and added network src

* updated SIZES for avatar network

* updated snapshot

* updated docs and props

* updated name of avatar

* removed comments

* updated avatar network component

* updated readme

* updated story for badge

* added constants to the root
2022-12-15 22:58:42 +05:30

124 lines
3.0 KiB
JavaScript

import React from 'react';
import {
COLORS,
SIZES,
DISPLAY,
ALIGN_ITEMS,
TEXT_COLORS,
BACKGROUND_COLORS,
BORDER_COLORS,
} from '../../../helpers/constants/design-system';
import Box from '../../ui/box/box';
import README from './README.mdx';
import { AvatarNetwork } from './avatar-network';
import { AVATAR_NETWORK_SIZES } from './avatar-network.constants';
export default {
title: 'Components/ComponentLibrary/AvatarNetwork',
id: __filename,
component: AvatarNetwork,
parameters: {
docs: {
page: README,
},
},
argTypes: {
size: {
control: 'select',
options: Object.values(AVATAR_NETWORK_SIZES),
},
color: {
options: Object.values(TEXT_COLORS),
control: 'select',
},
backgroundColor: {
options: Object.values(BACKGROUND_COLORS),
control: 'select',
},
borderColor: {
options: Object.values(BORDER_COLORS),
control: 'select',
},
name: {
control: 'text',
},
src: {
control: 'text',
},
showHalo: {
control: 'boolean',
},
},
args: {
name: 'Arbitrum One',
src: './images/arbitrum.svg',
size: SIZES.MD,
showHalo: false,
},
};
const Template = (args) => {
return <AvatarNetwork {...args} />;
};
export const DefaultStory = Template.bind({});
DefaultStory.storyName = 'Default';
export const Size = (args) => (
<Box display={DISPLAY.FLEX} alignItems={ALIGN_ITEMS.BASELINE} gap={1}>
<AvatarNetwork {...args} size={SIZES.XS} />
<AvatarNetwork {...args} size={SIZES.SM} />
<AvatarNetwork {...args} size={SIZES.MD} />
<AvatarNetwork {...args} size={SIZES.LG} />
<AvatarNetwork {...args} size={SIZES.XL} />
</Box>
);
export const Name = Template.bind({});
Name.args = {
src: '',
};
export const Src = (args) => (
<Box display={DISPLAY.FLEX} gap={1}>
<AvatarNetwork {...args} src="./images/matic-token.png" />
<AvatarNetwork {...args} src="./images/arbitrum.svg" />
<AvatarNetwork {...args} src="./images/optimism.svg" />
<AvatarNetwork {...args} src="./images/avax-token.png" />
<AvatarNetwork {...args} src="./images/palm.svg" />
<AvatarNetwork {...args} src="./images/bsc-filled.svg" />
<AvatarNetwork {...args} src="./images/fantom-opera.svg" />
<AvatarNetwork {...args} src="./images/harmony-one.svg" />
<AvatarNetwork {...args} src="./images/aurora.png" />
</Box>
);
export const ShowHalo = Template.bind({});
ShowHalo.args = {
showHalo: true,
};
export const ColorBackgroundColorAndBorderColor = (args) => (
<Box display={DISPLAY.FLEX} gap={1}>
<AvatarNetwork
{...args}
backgroundColor={COLORS.GOERLI}
borderColor={COLORS.GOERLI}
name="G"
color={COLORS.PRIMARY_INVERSE} // TODO: update it to COLORS.GOERLI_INVERSE
/>
<AvatarNetwork
{...args}
backgroundColor={COLORS.SEPOLIA}
borderColor={COLORS.SEPOLIA}
name="S"
color={COLORS.PRIMARY_INVERSE} // TODO: update it to COLORS.GOERLI_INVERSE
/>
</Box>
);
ColorBackgroundColorAndBorderColor.args = {
src: '',
};