1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-12 12:47:14 +01:00
metamask-extension/ui/components/component-library/avatar-network/avatar-network.stories.js
Nidhi Kumari f2514c88cf
added avatar network component (#15502)
* added avatar network component

* reset showFallback if networkUrl changes

* updated changed to avatar network

* updated test cases for avatar network

* updated story url in README

* added avatar network class Name

* updated readme for AvatarNetwork

* updated avatar network

* updated text changes to avatar Network and Avatar Token component

* updated space between useState and useEffect

* updated scss files in alphabetic order
2022-08-19 00:24:10 +05:30

124 lines
3.2 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';
export default {
title: 'Components/ComponentLibrary/AvatarNetwork',
id: __filename,
component: AvatarNetwork,
parameters: {
docs: {
page: README,
},
},
argTypes: {
size: {
control: 'select',
options: Object.values(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',
},
networkName: {
control: 'text',
},
networkImageUrl: {
control: 'text',
},
showHalo: {
control: 'boolean',
},
},
args: {
networkName: 'Arbitrum One',
networkImageUrl: './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 networkName = Template.bind({});
networkName.args = {
networkImageUrl: '',
};
export const networkImageUrl = Template.bind({});
export const showHalo = Template.bind({});
showHalo.args = {
showHalo: true,
};
export const ColorBackgroundColorAndBorderColor = (args) => (
<Box display={DISPLAY.FLEX} gap={1}>
<AvatarNetwork
{...args}
backgroundColor={COLORS.KOVAN}
borderColor={COLORS.KOVAN}
networkName="K"
color={COLORS.PRIMARY_INVERSE} // This will have to be added to the BaseAvatar component as a prop so we can change the color of the text and to the base avatar
/>
<AvatarNetwork
{...args}
backgroundColor={COLORS.RINKEBY}
borderColor={COLORS.RINKEBY}
networkName="R"
color={COLORS.PRIMARY_INVERSE} // This will have to be added to the BaseAvatar component as a prop so we can change the color of the text and to the base avatar
/>
<AvatarNetwork
{...args}
backgroundColor={COLORS.GOERLI}
borderColor={COLORS.GOERLI}
networkName="G"
color={COLORS.PRIMARY_INVERSE} // This will have to be added to the BaseAvatar component as a prop so we can change the color of the text and to the base avatar
/>
<AvatarNetwork
{...args}
backgroundColor={COLORS.ROPSTEN}
borderColor={COLORS.ROPSTEN}
networkName="R"
color={COLORS.PRIMARY_INVERSE} // This will have to be added to the BaseAvatar component as a prop so we can change the color of the text and to the base avatar
/>
</Box>
);
ColorBackgroundColorAndBorderColor.args = {
networkImageUrl: '',
};