mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-30 08:09:15 +01:00
56a3afaace
* avatar account housekeeping * avatar number to the diametere * fixed lint errors * converting blockie to number * updated README * updated constants for avatar account
87 lines
2.4 KiB
Plaintext
87 lines
2.4 KiB
Plaintext
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="ui-components-component-library-avatar-account-avatar-account-stories-js--default-story" />
|
|
</Canvas>
|
|
|
|
## Props
|
|
|
|
The `AvatarAccount` accepts all props below as well as all [Box](/docs/ui-components-ui-box-box-stories-js--default-story) component props
|
|
|
|
<ArgsTable of={AvatarAccount} />
|
|
|
|
`AvatarAccount` accepts all [AvatarBase](/docs/ui-components-component-library-avatar-base-avatar-base-stories-js--default-story#props)
|
|
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="ui-components-component-library-avatar-account-avatar-account-stories-js--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="ui-components-component-library-avatar-account-avatar-account-stories-js--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="ui-components-component-library-avatar-account-avatar-account-stories-js--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" />
|
|
```
|