2022-12-08 19:25:19 +01:00
|
|
|
import React from 'react';
|
|
|
|
import {
|
2023-02-02 21:15:26 +01:00
|
|
|
Size,
|
2022-12-08 19:25:19 +01:00
|
|
|
DISPLAY,
|
2023-02-02 21:15:26 +01:00
|
|
|
AlignItems,
|
|
|
|
BackgroundColor,
|
|
|
|
IconColor,
|
|
|
|
Color,
|
2022-12-08 19:25:19 +01:00
|
|
|
} from '../../../helpers/constants/design-system';
|
|
|
|
|
|
|
|
import Box from '../../ui/box/box';
|
|
|
|
|
2023-04-05 18:11:10 +02:00
|
|
|
import { IconName } from '..';
|
2022-12-08 19:25:19 +01:00
|
|
|
|
|
|
|
import README from './README.mdx';
|
|
|
|
import { AvatarIcon, AVATAR_ICON_SIZES } from '.';
|
|
|
|
|
|
|
|
const marginSizeControlOptions = [
|
|
|
|
undefined,
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
10,
|
|
|
|
11,
|
|
|
|
12,
|
|
|
|
'auto',
|
|
|
|
];
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Components/ComponentLibrary/AvatarIcon',
|
|
|
|
component: AvatarIcon,
|
|
|
|
parameters: {
|
|
|
|
docs: {
|
|
|
|
page: README,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
argTypes: {
|
|
|
|
iconName: {
|
2023-04-05 18:11:10 +02:00
|
|
|
options: Object.values(IconName),
|
2022-12-08 19:25:19 +01:00
|
|
|
control: 'select',
|
|
|
|
},
|
|
|
|
size: {
|
|
|
|
control: 'select',
|
|
|
|
options: Object.values(AVATAR_ICON_SIZES),
|
|
|
|
},
|
|
|
|
backgroundColor: {
|
|
|
|
control: 'select',
|
2023-02-02 21:15:26 +01:00
|
|
|
options: Object.values(BackgroundColor),
|
2022-12-08 19:25:19 +01:00
|
|
|
},
|
|
|
|
color: {
|
|
|
|
control: 'select',
|
2023-02-02 21:15:26 +01:00
|
|
|
options: Object.values(Color),
|
2022-12-08 19:25:19 +01:00
|
|
|
},
|
|
|
|
className: {
|
|
|
|
control: 'text',
|
|
|
|
},
|
|
|
|
marginTop: {
|
|
|
|
options: marginSizeControlOptions,
|
|
|
|
control: 'select',
|
|
|
|
table: { category: 'box props' },
|
|
|
|
},
|
|
|
|
marginRight: {
|
|
|
|
options: marginSizeControlOptions,
|
|
|
|
control: 'select',
|
|
|
|
table: { category: 'box props' },
|
|
|
|
},
|
|
|
|
marginBottom: {
|
|
|
|
options: marginSizeControlOptions,
|
|
|
|
control: 'select',
|
|
|
|
table: { category: 'box props' },
|
|
|
|
},
|
|
|
|
marginLeft: {
|
|
|
|
options: marginSizeControlOptions,
|
|
|
|
control: 'select',
|
|
|
|
table: { category: 'box props' },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
args: {
|
2023-02-02 21:15:26 +01:00
|
|
|
size: Size.MD,
|
2022-12-08 19:25:19 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const Template = (args) => {
|
2023-04-05 18:11:10 +02:00
|
|
|
return <AvatarIcon iconName={IconName.SwapHorizontal} {...args} />;
|
2022-12-08 19:25:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export const DefaultStory = Template.bind({});
|
|
|
|
DefaultStory.storyName = 'Default';
|
|
|
|
|
2023-02-02 21:15:26 +01:00
|
|
|
export const SizeStory = (args) => (
|
|
|
|
<Box display={DISPLAY.FLEX} alignItems={AlignItems.baseline} gap={1}>
|
|
|
|
<AvatarIcon {...args} size={Size.XS} />
|
|
|
|
<AvatarIcon {...args} size={Size.SM} />
|
|
|
|
<AvatarIcon {...args} size={Size.MD} />
|
|
|
|
<AvatarIcon {...args} size={Size.LG} />
|
|
|
|
<AvatarIcon {...args} size={Size.XL} />
|
2022-12-08 19:25:19 +01:00
|
|
|
</Box>
|
|
|
|
);
|
2023-02-02 21:15:26 +01:00
|
|
|
SizeStory.storyName = 'Size';
|
2022-12-08 19:25:19 +01:00
|
|
|
|
2023-02-14 18:33:04 +01:00
|
|
|
SizeStory.args = {
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName: IconName.Confirmation,
|
2022-12-08 19:25:19 +01:00
|
|
|
};
|
|
|
|
|
2023-04-05 18:11:10 +02:00
|
|
|
export const IconNameStory = (args) => (
|
2022-12-08 19:25:19 +01:00
|
|
|
<Box display={DISPLAY.FLEX} gap={1}>
|
|
|
|
<AvatarIcon
|
2023-02-02 21:15:26 +01:00
|
|
|
color={IconColor.primaryDefault}
|
|
|
|
backgroundColor={BackgroundColor.primaryMuted}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.SwapHorizontal}
|
2022-12-08 19:25:19 +01:00
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
<AvatarIcon
|
2023-02-02 21:15:26 +01:00
|
|
|
color={IconColor.successDefault}
|
|
|
|
backgroundColor={BackgroundColor.successMuted}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Confirmation}
|
2022-12-08 19:25:19 +01:00
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
<AvatarIcon
|
2023-02-02 21:15:26 +01:00
|
|
|
color={IconColor.infoDefault}
|
|
|
|
backgroundColor={BackgroundColor.infoMuted}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Info}
|
2022-12-08 19:25:19 +01:00
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
<AvatarIcon
|
2023-02-02 21:15:26 +01:00
|
|
|
color={IconColor.warningDefault}
|
|
|
|
backgroundColor={BackgroundColor.warningMuted}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Warning}
|
2022-12-08 19:25:19 +01:00
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
<AvatarIcon
|
2023-02-02 21:15:26 +01:00
|
|
|
color={IconColor.errorDefault}
|
|
|
|
backgroundColor={BackgroundColor.errorMuted}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Danger}
|
2022-12-08 19:25:19 +01:00
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
|
2023-04-05 18:11:10 +02:00
|
|
|
IconNameStory.storyName = 'Icon Name';
|
|
|
|
|
2022-12-08 19:25:19 +01:00
|
|
|
export const ColorAndBackgroundColor = (args) => (
|
|
|
|
<Box display={DISPLAY.FLEX} gap={1}>
|
|
|
|
<AvatarIcon
|
2023-02-02 21:15:26 +01:00
|
|
|
color={IconColor.primaryDefault}
|
|
|
|
backgroundColor={BackgroundColor.primaryMuted}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.SwapHorizontal}
|
2022-12-08 19:25:19 +01:00
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
<AvatarIcon
|
2023-02-02 21:15:26 +01:00
|
|
|
color={IconColor.primaryInverse}
|
|
|
|
backgroundColor={BackgroundColor.primaryDefault}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.SwapHorizontal}
|
2022-12-08 19:25:19 +01:00
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
<AvatarIcon
|
2023-02-02 21:15:26 +01:00
|
|
|
color={IconColor.successDefault}
|
|
|
|
backgroundColor={BackgroundColor.successMuted}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Confirmation}
|
2022-12-08 19:25:19 +01:00
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
<AvatarIcon
|
2023-02-02 21:15:26 +01:00
|
|
|
color={IconColor.infoDefault}
|
|
|
|
backgroundColor={BackgroundColor.infoMuted}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Info}
|
2022-12-08 19:25:19 +01:00
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
<AvatarIcon
|
2023-02-02 21:15:26 +01:00
|
|
|
color={IconColor.warningDefault}
|
|
|
|
backgroundColor={BackgroundColor.warningMuted}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Warning}
|
2022-12-08 19:25:19 +01:00
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
<AvatarIcon
|
2023-02-02 21:15:26 +01:00
|
|
|
color={IconColor.errorDefault}
|
|
|
|
backgroundColor={BackgroundColor.errorMuted}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Danger}
|
2022-12-08 19:25:19 +01:00
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
</Box>
|
|
|
|
);
|