1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00
metamask-extension/ui/components/component-library/avatar-token
Nidhi Kumari 119a5a4dc4
added avatar token component (#15466)
* added avatar token component

* added avatar token component story

* added avatar token readme to story

* added avatar token readme to story

* added halo effect

* added test to avatar token component

* fixed alt name

* added test for blur

* added test for aria hidden element

* fixed fallback issue

* updated halo id in README

* added changes to avatar token stories

* updated stories and README in storybook

* fixed indentation in stories

* changed component name structure

* updated css for avatar halo image

* updated README for Avatar Base Component

* added className to avatar Token

* Updates to docs and styles

* fixed tests for Avatar Token

* added color to the props

* fixed table props issue

* updated avatar token Readme

* updated args in avatar token stories

Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
2022-08-18 22:00:19 +05:30
..
avatar-token.js added avatar token component (#15466) 2022-08-18 22:00:19 +05:30
avatar-token.scss added avatar token component (#15466) 2022-08-18 22:00:19 +05:30
avatar-token.stories.js added avatar token component (#15466) 2022-08-18 22:00:19 +05:30
avatar-token.test.js added avatar token component (#15466) 2022-08-18 22:00:19 +05:30
index.js added avatar token component (#15466) 2022-08-18 22:00:19 +05:30
README.mdx added avatar token component (#15466) 2022-08-18 22:00:19 +05:30

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

import { AvatarToken } from './avatar-token';

# AvatarToken

The `AvatarToken` is a component responsible for display of the image of a given token

<Canvas>
  <Story id="ui-components-component-library-avatar-token-avatar-token-stories-js--default-story" />
</Canvas>

## Props

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

<ArgsTable of={AvatarToken} />

### Size

Use the `size` prop to set the size of the `AvatarToken`.

Possible sizes include:

- `xs` 16px
- `sm` 24px
- `md` 32px
- `lg` 40px
- `xl` 48px

Defaults to `md`

<Canvas>
  <Story id="ui-components-component-library-avatar-token-avatar-token-stories-js--size" />
</Canvas>

### Token Name

Use the ` tokenName` prop to set the initial letter of the `AvatarToken`. This will be used as the fallback display if no image url is passed to the `tokenImageUrl` prop.

<Canvas>
  <Story id="ui-components-component-library-avatar-token-avatar-token-stories-js--token-name" />
</Canvas>

### Token Image Url

Use the `tokenImageUrl` prop to set the image to be rendered of the `AvatarToken`.

<Canvas>
  <Story id="ui-components-component-library-avatar-token-avatar-token-stories-js--token-image-url" />
</Canvas>

### Show Halo

If we want to display the component with halo effect. Only works if an image url is supplied to `tokenImageUrl`

<Canvas>
  <Story id="ui-components-component-library-avatar-token-avatar-token-stories-js--show-halo" />
</Canvas>

### Color, Background Color And Border Color

Use the `color`, `backgroundColor` and `borderColor` props to set the text color, background-color and border-color of the `AvatarToken`.

<Canvas>
  <Story id="ui-components-component-library-avatar-token-avatar-token-stories-js--color-background-color-and-border-color" />
</Canvas>