2022-08-18 18:30:19 +02:00
|
|
|
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 { AvatarToken } from './avatar-token';
|
2022-12-15 18:29:24 +01:00
|
|
|
import { AVATAR_TOKEN_SIZES } from './avatar-token.constants';
|
2022-08-18 18:30:19 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Components/ComponentLibrary/AvatarToken',
|
2023-01-20 20:27:46 +01:00
|
|
|
|
2022-08-18 18:30:19 +02:00
|
|
|
component: AvatarToken,
|
|
|
|
parameters: {
|
|
|
|
docs: {
|
|
|
|
page: README,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
argTypes: {
|
|
|
|
size: {
|
|
|
|
control: 'select',
|
2022-12-15 18:29:24 +01:00
|
|
|
options: Object.values(AVATAR_TOKEN_SIZES),
|
2022-08-18 18:30:19 +02:00
|
|
|
},
|
|
|
|
color: {
|
|
|
|
options: Object.values(TEXT_COLORS),
|
|
|
|
control: 'select',
|
|
|
|
},
|
|
|
|
backgroundColor: {
|
|
|
|
options: Object.values(BACKGROUND_COLORS),
|
|
|
|
control: 'select',
|
|
|
|
},
|
|
|
|
borderColor: {
|
|
|
|
options: Object.values(BORDER_COLORS),
|
|
|
|
control: 'select',
|
|
|
|
},
|
2022-12-15 18:29:24 +01:00
|
|
|
name: {
|
2022-08-18 18:30:19 +02:00
|
|
|
control: 'text',
|
|
|
|
},
|
2022-12-15 18:29:24 +01:00
|
|
|
src: {
|
2022-08-18 18:30:19 +02:00
|
|
|
control: 'text',
|
|
|
|
},
|
|
|
|
showHalo: {
|
|
|
|
control: 'boolean',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
args: {
|
2022-12-15 18:29:24 +01:00
|
|
|
name: 'eth',
|
|
|
|
src: './images/eth_logo.svg',
|
2022-08-18 18:30:19 +02:00
|
|
|
size: SIZES.MD,
|
|
|
|
showHalo: false,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const Template = (args) => {
|
|
|
|
return <AvatarToken {...args} />;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const DefaultStory = Template.bind({});
|
|
|
|
DefaultStory.storyName = 'Default';
|
|
|
|
|
|
|
|
export const Size = (args) => (
|
|
|
|
<Box display={DISPLAY.FLEX} alignItems={ALIGN_ITEMS.BASELINE} gap={1}>
|
|
|
|
<AvatarToken {...args} size={SIZES.XS} />
|
|
|
|
<AvatarToken {...args} size={SIZES.SM} />
|
|
|
|
<AvatarToken {...args} size={SIZES.MD} />
|
|
|
|
<AvatarToken {...args} size={SIZES.LG} />
|
|
|
|
<AvatarToken {...args} size={SIZES.XL} />
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
|
2022-12-15 18:29:24 +01:00
|
|
|
export const Name = Template.bind({});
|
|
|
|
Name.args = {
|
|
|
|
src: '',
|
2022-08-18 18:30:19 +02:00
|
|
|
};
|
|
|
|
|
2022-12-15 18:29:24 +01:00
|
|
|
export const Src = (args) => (
|
|
|
|
<Box display={DISPLAY.FLEX} gap={1}>
|
|
|
|
<AvatarToken {...args} src="./images/eth_logo.svg" />
|
|
|
|
<AvatarToken {...args} src="./images/arbitrum.svg" />
|
|
|
|
<AvatarToken {...args} src="./images/bnb.png" />
|
|
|
|
<AvatarToken
|
|
|
|
{...args}
|
|
|
|
src="https://static.metaswap.codefi.network/api/v1/tokenIcons/1/0x6b175474e89094c44da98b954eedeac495271d0f.png"
|
|
|
|
/>
|
|
|
|
<AvatarToken
|
|
|
|
{...args}
|
|
|
|
src="https://static.metaswap.codefi.network/api/v1/tokenIcons/1/0x0d8775f648430679a709e98d2b0cb6250d2887ef.png"
|
|
|
|
/>
|
|
|
|
<AvatarToken
|
|
|
|
{...args}
|
|
|
|
src="https://static.metaswap.codefi.network/api/v1/tokenIcons/1/0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0.png"
|
|
|
|
/>
|
|
|
|
<AvatarToken
|
|
|
|
{...args}
|
|
|
|
src="https://i.seadn.io/gae/lSm8ChaI-3RqC9MTpi0j3KBXdfdPd57PN5UeQLY49JA3twy9wSt2dpaa22sSc6oyiXi2OEUR6GeFX8jwkZHEMADu6_Bd4EwTJ-rg?w=500&auto=format"
|
|
|
|
/>
|
|
|
|
</Box>
|
|
|
|
);
|
2022-08-18 18:30:19 +02:00
|
|
|
|
2022-09-12 17:32:09 +02:00
|
|
|
export const ShowHalo = Template.bind({});
|
|
|
|
ShowHalo.args = {
|
2022-08-18 18:30:19 +02:00
|
|
|
showHalo: true,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const ColorBackgroundColorAndBorderColor = (args) => (
|
|
|
|
<Box display={DISPLAY.FLEX} gap={1}>
|
|
|
|
<AvatarToken
|
|
|
|
{...args}
|
|
|
|
backgroundColor={COLORS.GOERLI}
|
|
|
|
borderColor={COLORS.GOERLI}
|
2022-12-15 18:29:24 +01:00
|
|
|
name="G"
|
|
|
|
color={COLORS.PRIMARY_INVERSE} // TODO: update it to COLORS.GOERLI_INVERSE
|
2022-08-18 18:30:19 +02:00
|
|
|
/>
|
2022-09-14 20:26:45 +02:00
|
|
|
<AvatarToken
|
|
|
|
{...args}
|
|
|
|
backgroundColor={COLORS.SEPOLIA}
|
|
|
|
borderColor={COLORS.SEPOLIA}
|
2022-12-15 18:29:24 +01:00
|
|
|
name="S"
|
|
|
|
color={COLORS.PRIMARY_INVERSE} // TODO: update it to COLORS.GOERLI_INVERSE
|
2022-09-14 20:26:45 +02:00
|
|
|
/>
|
2022-08-18 18:30:19 +02:00
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
ColorBackgroundColorAndBorderColor.args = {
|
2022-12-15 18:29:24 +01:00
|
|
|
src: '',
|
2022-08-18 18:30:19 +02:00
|
|
|
};
|