2022-08-01 11:44:33 +02:00
|
|
|
import React from 'react';
|
|
|
|
import {
|
|
|
|
ALIGN_ITEMS,
|
|
|
|
COLORS,
|
|
|
|
DISPLAY,
|
2022-08-18 18:30:19 +02:00
|
|
|
TEXT_COLORS,
|
|
|
|
BACKGROUND_COLORS,
|
|
|
|
BORDER_COLORS,
|
2022-08-01 11:44:33 +02:00
|
|
|
} from '../../../helpers/constants/design-system';
|
2022-08-18 18:30:19 +02:00
|
|
|
|
2022-08-01 11:44:33 +02:00
|
|
|
import Box from '../../ui/box/box';
|
|
|
|
|
|
|
|
import README from './README.mdx';
|
2022-11-23 17:42:43 +01:00
|
|
|
import { AvatarBase } from './avatar-base';
|
|
|
|
import { AVATAR_BASE_SIZES } from './avatar-base.constants';
|
2022-08-01 11:44:33 +02:00
|
|
|
|
|
|
|
const marginSizeKnobOptions = [
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
'auto',
|
|
|
|
];
|
|
|
|
|
|
|
|
export default {
|
2022-11-23 17:42:43 +01:00
|
|
|
title: 'Components/ComponentLibrary/AvatarBase',
|
2022-08-01 11:44:33 +02:00
|
|
|
id: __filename,
|
2022-11-23 17:42:43 +01:00
|
|
|
component: AvatarBase,
|
2022-08-01 11:44:33 +02:00
|
|
|
parameters: {
|
|
|
|
docs: {
|
|
|
|
page: README,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
argTypes: {
|
|
|
|
size: {
|
|
|
|
control: 'select',
|
2022-11-23 17:42:43 +01:00
|
|
|
options: Object.values(AVATAR_BASE_SIZES),
|
2022-08-01 11:44:33 +02:00
|
|
|
},
|
2022-08-18 18:30:19 +02:00
|
|
|
color: {
|
|
|
|
options: Object.values(TEXT_COLORS),
|
|
|
|
control: 'select',
|
|
|
|
},
|
2022-08-01 11:44:33 +02:00
|
|
|
backgroundColor: {
|
2022-08-18 18:30:19 +02:00
|
|
|
options: Object.values(BACKGROUND_COLORS),
|
2022-08-01 11:44:33 +02:00
|
|
|
control: 'select',
|
|
|
|
},
|
|
|
|
borderColor: {
|
2022-08-18 18:30:19 +02:00
|
|
|
options: Object.values(BORDER_COLORS),
|
2022-08-01 11:44:33 +02:00
|
|
|
control: 'select',
|
|
|
|
},
|
|
|
|
display: {
|
|
|
|
options: Object.values(DISPLAY),
|
|
|
|
control: 'select',
|
|
|
|
defaultValue: DISPLAY.FLEX,
|
|
|
|
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: {
|
2022-11-23 17:42:43 +01:00
|
|
|
size: AVATAR_BASE_SIZES.MD,
|
2022-08-18 18:30:19 +02:00
|
|
|
color: COLORS.TEXT_DEFAULT,
|
2022-08-01 11:44:33 +02:00
|
|
|
backgroundColor: COLORS.BACKGROUND_ALTERNATIVE,
|
|
|
|
borderColor: COLORS.BORDER_DEFAULT,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-11-23 17:42:43 +01:00
|
|
|
export const DefaultStory = (args) => <AvatarBase {...args}>B</AvatarBase>;
|
2022-08-01 11:44:33 +02:00
|
|
|
|
|
|
|
DefaultStory.storyName = 'Default';
|
|
|
|
|
|
|
|
export const Size = (args) => (
|
|
|
|
<Box display={DISPLAY.FLEX} alignItems={ALIGN_ITEMS.BASELINE} gap={1}>
|
2022-11-23 17:42:43 +01:00
|
|
|
<AvatarBase {...args} size={AVATAR_BASE_SIZES.XS} />
|
|
|
|
<AvatarBase {...args} size={AVATAR_BASE_SIZES.SM} />
|
|
|
|
<AvatarBase {...args} size={AVATAR_BASE_SIZES.MD} />
|
|
|
|
<AvatarBase {...args} size={AVATAR_BASE_SIZES.LG} />
|
|
|
|
<AvatarBase {...args} size={AVATAR_BASE_SIZES.XL} />
|
2022-08-01 11:44:33 +02:00
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
|
|
|
|
export const Children = (args) => (
|
|
|
|
<Box display={DISPLAY.FLEX} gap={1}>
|
2022-11-23 17:42:43 +01:00
|
|
|
<AvatarBase {...args}>
|
2022-08-01 11:44:33 +02:00
|
|
|
<img src="./images/eth_logo.svg" />
|
2022-11-23 17:42:43 +01:00
|
|
|
</AvatarBase>
|
|
|
|
<AvatarBase {...args}>
|
2022-08-01 11:44:33 +02:00
|
|
|
<img width="100%" src="./images/arbitrum.svg" />
|
2022-11-23 17:42:43 +01:00
|
|
|
</AvatarBase>
|
|
|
|
<AvatarBase {...args}>
|
2022-08-01 11:44:33 +02:00
|
|
|
<img width="100%" src="./images/avax-token.png" />
|
2022-11-23 17:42:43 +01:00
|
|
|
</AvatarBase>
|
|
|
|
<AvatarBase {...args}>A</AvatarBase>
|
|
|
|
<AvatarBase
|
2022-08-01 11:44:33 +02:00
|
|
|
{...args}
|
|
|
|
backgroundColor={COLORS.INFO_MUTED}
|
|
|
|
borderColor={COLORS.INFO_MUTED}
|
|
|
|
>
|
|
|
|
<i
|
|
|
|
className="fa fa-user"
|
|
|
|
style={{ color: 'var(--color-info-default)' }}
|
|
|
|
/>
|
2022-11-23 17:42:43 +01:00
|
|
|
</AvatarBase>
|
2022-08-01 11:44:33 +02:00
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
|
2022-08-18 18:30:19 +02:00
|
|
|
export const ColorBackgroundColorAndBorderColor = (args) => (
|
2022-08-01 11:44:33 +02:00
|
|
|
<Box display={DISPLAY.FLEX} gap={1}>
|
2022-11-23 17:42:43 +01:00
|
|
|
<AvatarBase {...args}>B</AvatarBase>
|
|
|
|
<AvatarBase
|
2022-08-01 11:44:33 +02:00
|
|
|
{...args}
|
|
|
|
backgroundColor={COLORS.GOERLI}
|
|
|
|
borderColor={COLORS.GOERLI}
|
2022-11-23 17:42:43 +01:00
|
|
|
color={COLORS.PRIMARY_INVERSE}
|
2022-08-01 11:44:33 +02:00
|
|
|
>
|
|
|
|
G
|
2022-11-23 17:42:43 +01:00
|
|
|
</AvatarBase>
|
|
|
|
<AvatarBase
|
2022-09-14 20:26:45 +02:00
|
|
|
{...args}
|
|
|
|
backgroundColor={COLORS.SEPOLIA}
|
|
|
|
borderColor={COLORS.SEPOLIA}
|
2022-11-23 17:42:43 +01:00
|
|
|
color={COLORS.PRIMARY_INVERSE}
|
2022-09-14 20:26:45 +02:00
|
|
|
>
|
|
|
|
S
|
2022-11-23 17:42:43 +01:00
|
|
|
</AvatarBase>
|
2022-08-01 11:44:33 +02:00
|
|
|
</Box>
|
|
|
|
);
|