1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 20:39:08 +01:00
metamask-extension/ui/components/component-library/avatar-account
Nidhi Kumari c5368c152b
Added storybook check to CI (#17092)
* added storybook test runner

* added test runner in ci

* updated test for ci and fixed lint error

* updated lavamoat policy

* updated test command

* updated playwright

* changed command to storybook;ci

* updated command

* updated instance for test-storybook

* updated playwright

* added playwright step

* replaced concurrently with start-server-and-test

* updated the static storybook directory

* replaced first with last

* updated lock file

* replaced first with last

* updated test-storybook with maxworkers

* updated .depchechrc

* updated yml

* removed id from banner base

* replaced broken stories with .stories-to-do.js extesnsion

* updated token allowance story

* removed duplicacies from yarn

* fixed lavamoat

* removed filename comment

* updated links for docs

* fixed file extension for stories

* updated path for stories.json

* updated stories.json path

* yarn updated

* updated stories

* updated yarn

* updated wait on
2023-01-21 00:57:46 +05:30
..
__snapshots__ avatar account housekeeping (#16930) 2023-01-09 16:38:43 -08:00
avatar-account.constants.js avatar account housekeeping (#16930) 2023-01-09 16:38:43 -08:00
avatar-account.js avatar account housekeeping (#16930) 2023-01-09 16:38:43 -08:00
avatar-account.scss avatar account housekeeping (#16930) 2023-01-09 16:38:43 -08:00
avatar-account.stories.js Added storybook check to CI (#17092) 2023-01-21 00:57:46 +05:30
avatar-account.test.js avatar account housekeeping (#16930) 2023-01-09 16:38:43 -08:00
index.js avatar account housekeeping (#16930) 2023-01-09 16:38:43 -08:00
README.mdx Added storybook check to CI (#17092) 2023-01-21 00:57:46 +05:30

import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';

import { AvatarAccount } from './avatar-account';
import { AvatarBase } from '../';

# AvatarAccount

The `AvatarAccount` is a type of avatar reserved for representing accounts.

<Canvas>
  <Story id="components-componentlibrary-avataraccount--default-story" />
</Canvas>

## Props

The `AvatarAccount` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) component props

<ArgsTable of={AvatarAccount} />

`AvatarAccount` accepts all [AvatarBase](/docs/components-componentlibrary-avatarbase--default-story))
component props

<ArgsTable of={AvatarBase} />

### Size

Use the `size` prop and the `SIZES` object from `./ui/helpers/constants/design-system.js` to change the size of `AvatarAccount`

Optional: `AVATAR_ACCOUNT_SIZES` from `./ui/components/component-library` object can be used instead of `SIZES`

Possible sizes include:

- `SIZES.XS` 16px
- `SIZES.SM` 24px
- `SIZES.MD` 32px
- `SIZES.LG` 40px
- `SIZES.XL` 48px

Defaults to `SIZES.MD`

<Canvas>
  <Story id="components-componentlibrary-avataraccount--size" />
</Canvas>

```jsx
import { SIZES } from '../../../helpers/constants/design-system';
import { AvatarAccount } from '../ui/component-library';

<AvatarAccount size={SIZES.XS} />
<AvatarAccount size={SIZES.SM} />
<AvatarAccount size={SIZES.MD} />
<AvatarAccount size={SIZES.LG} />
<AvatarAccount size={SIZES.XL} />
```

### Type

Use the `type` prop for the avatar to be rendered, it can either be a Jazzicon or a Blockie

<Canvas>
  <Story id="components-componentlibrary-avataraccount--type" />
</Canvas>

```jsx
import { TYPES } from './avatar-account.constants';
import { AvatarAccount } from '../ui/component-library';

<AvatarAccount type={TYPES.JAZZICON} />
<AvatarAccount type={TYPES.BLOCKIES} />
```

### Address

Use the required `address` for generating images

<Canvas>
  <Story id="components-componentlibrary-avataraccount--address" />
</Canvas>

```jsx
import { TYPES } from './avatar-account.constants';
import { AvatarAccount } from '../ui/component-library';

<AvatarAccount type={TYPES.JAZZICON} address="0x5CfE73b6021E818B776b421B1c4Db2474086a7e1" />
<AvatarAccount type={TYPES.BLOCKIES} address="0x0" />
```