1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00
metamask-extension/ui/components/component-library/avatar-account/avatar-account.stories.js
George Marshall 5d5fa242c3
Updating AvatarAccount objects to enums (#17727)
* Updating object to enums

* lint fix

* Improving test coverage

* Updating filename to .types.ts
2023-03-10 12:12:55 -08:00

75 lines
2.1 KiB
JavaScript

import React from 'react';
import Box from '../../ui/box/box';
import { AlignItems, DISPLAY } from '../../../helpers/constants/design-system';
import { AvatarAccount } from './avatar-account';
import {
AvatarAccountVariant,
AvatarAccountSize,
} from './avatar-account.types';
import README from './README.mdx';
export default {
title: 'Components/ComponentLibrary/AvatarAccount',
component: AvatarAccount,
parameters: {
docs: {
page: README,
},
},
argTypes: {
size: {
control: 'select',
options: Object.values(AvatarAccountSize).map(
(value) => value.toLowerCase(), // Removes reverse mapping from enum this is a temporary fix until we are using typescript for everything
),
},
address: { control: 'text' },
variant: {
control: 'select',
options: Object.values(AvatarAccountVariant),
},
},
args: {
address: '0x5CfE73b6021E818B776b421B1c4Db2474086a7e1',
size: AvatarAccountSize.Md,
variant: AvatarAccountVariant.Jazzicon,
},
};
export const DefaultStory = (args) => <AvatarAccount {...args} />;
DefaultStory.storyName = 'Default';
export const Size = (args) => (
<Box display={DISPLAY.FLEX} alignItems={AlignItems.baseline} gap={1}>
<AvatarAccount {...args} size={AvatarAccountSize.Xs} />
<AvatarAccount {...args} size={AvatarAccountSize.Sm} />
<AvatarAccount {...args} size={AvatarAccountSize.Md} />
<AvatarAccount {...args} size={AvatarAccountSize.Lg} />
<AvatarAccount {...args} size={AvatarAccountSize.Xl} />
</Box>
);
export const Variant = (args) => (
<Box display={DISPLAY.FLEX} alignItems={AlignItems.baseline} gap={1}>
<AvatarAccount {...args} variant={AvatarAccountVariant.Jazzicon} />
<AvatarAccount {...args} variant={AvatarAccountVariant.Blockies} />
</Box>
);
export const Address = (args) => (
<Box display={DISPLAY.FLEX} alignItems={AlignItems.BASELINE} gap={1}>
<AvatarAccount
{...args}
variant={AvatarAccountVariant.Jazzicon}
address="0x5CfE73b6021E818B776b421B1c4Db2474086a7e1"
/>
<AvatarAccount
{...args}
variant={AvatarAccountVariant.Blockies}
address="0x0"
/>
</Box>
);