2022-10-07 17:53:40 +02:00
|
|
|
import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';
|
|
|
|
|
|
|
|
import { AvatarAccount } from './avatar-account';
|
2023-01-10 01:38:43 +01:00
|
|
|
import { AvatarBase } from '../';
|
2022-10-07 17:53:40 +02:00
|
|
|
|
|
|
|
# AvatarAccount
|
|
|
|
|
|
|
|
The `AvatarAccount` is a type of avatar reserved for representing accounts.
|
|
|
|
|
|
|
|
<Canvas>
|
2023-01-20 20:27:46 +01:00
|
|
|
<Story id="components-componentlibrary-avataraccount--default-story" />
|
2022-10-07 17:53:40 +02:00
|
|
|
</Canvas>
|
|
|
|
|
|
|
|
## Props
|
|
|
|
|
2023-01-20 20:27:46 +01:00
|
|
|
The `AvatarAccount` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) component props
|
2022-10-07 17:53:40 +02:00
|
|
|
|
|
|
|
<ArgsTable of={AvatarAccount} />
|
|
|
|
|
2023-01-20 20:27:46 +01:00
|
|
|
`AvatarAccount` accepts all [AvatarBase](/docs/components-componentlibrary-avatarbase--default-story))
|
2023-01-10 01:38:43 +01:00
|
|
|
component props
|
|
|
|
|
|
|
|
<ArgsTable of={AvatarBase} />
|
|
|
|
|
2022-10-07 17:53:40 +02:00
|
|
|
### Size
|
|
|
|
|
2023-02-02 21:15:26 +01:00
|
|
|
Use the `size` prop and the `Size` object from `./ui/helpers/constants/design-system.js` to change the size of `AvatarAccount`
|
2023-01-10 01:38:43 +01:00
|
|
|
|
|
|
|
Optional: `AVATAR_ACCOUNT_SIZES` from `./ui/components/component-library` object can be used instead of `SIZES`
|
2022-10-07 17:53:40 +02:00
|
|
|
|
|
|
|
Possible sizes include:
|
|
|
|
|
2023-02-02 21:15:26 +01:00
|
|
|
- `Size.XS` 16px
|
|
|
|
- `Size.SM` 24px
|
|
|
|
- `Size.MD` 32px
|
|
|
|
- `Size.LG` 40px
|
|
|
|
- `Size.XL` 48px
|
2022-10-07 17:53:40 +02:00
|
|
|
|
2023-01-10 01:38:43 +01:00
|
|
|
Defaults to `SIZES.MD`
|
2022-10-07 17:53:40 +02:00
|
|
|
|
|
|
|
<Canvas>
|
2023-01-20 20:27:46 +01:00
|
|
|
<Story id="components-componentlibrary-avataraccount--size" />
|
2022-10-07 17:53:40 +02:00
|
|
|
</Canvas>
|
|
|
|
|
2023-01-10 01:38:43 +01:00
|
|
|
```jsx
|
2023-02-02 21:15:26 +01:00
|
|
|
import { Size } from '../../../helpers/constants/design-system';
|
2023-01-10 01:38:43 +01:00
|
|
|
import { AvatarAccount } from '../ui/component-library';
|
|
|
|
|
2023-02-02 21:15:26 +01:00
|
|
|
<AvatarAccount size={Size.XS} />
|
|
|
|
<AvatarAccount size={Size.SM} />
|
|
|
|
<AvatarAccount size={Size.MD} />
|
|
|
|
<AvatarAccount size={Size.LG} />
|
|
|
|
<AvatarAccount size={Size.XL} />
|
2023-01-10 01:38:43 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
### Type
|
2022-10-07 17:53:40 +02:00
|
|
|
|
|
|
|
Use the `type` prop for the avatar to be rendered, it can either be a Jazzicon or a Blockie
|
|
|
|
|
|
|
|
<Canvas>
|
2023-01-20 20:27:46 +01:00
|
|
|
<Story id="components-componentlibrary-avataraccount--type" />
|
2023-01-10 01:38:43 +01:00
|
|
|
</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>
|
2023-01-20 20:27:46 +01:00
|
|
|
<Story id="components-componentlibrary-avataraccount--address" />
|
2023-01-10 01:38:43 +01:00
|
|
|
</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" />
|
|
|
|
```
|