1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 15:50:28 +01:00
metamask-extension/ui/components/component-library/avatar-network
Nidhi Kumari 67bfd446fc
avatar base component housekeeping (#16583)
* replace base avatar with avatar base component

* updated tests

* updated description for props

* updated docs and background colors

* updated snapshot

* replaced size with avatar size constant

* added tests and fixed indentation

* fixed indentation in readme
2022-11-23 22:12:43 +05:30
..
avatar-network.js avatar base component housekeeping (#16583) 2022-11-23 22:12:43 +05:30
avatar-network.scss added avatar network component (#15502) 2022-08-19 00:24:10 +05:30
avatar-network.stories.js avatar base component housekeeping (#16583) 2022-11-23 22:12:43 +05:30
avatar-network.test.js added avatar network component (#15502) 2022-08-19 00:24:10 +05:30
index.js added avatar network component (#15502) 2022-08-19 00:24:10 +05:30
README.mdx added avatar network component (#15502) 2022-08-19 00:24:10 +05:30

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

import { AvatarNetwork } from './avatar-network';

# AvatarNetwork

The `AvatarNetwork` is a component responsible for display of the image of a given network

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

## Props

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

<ArgsTable of={AvatarNetwork} />

### Size

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

Possible sizes include:

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

Defaults to `md`

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

###  Network Name

Use the `networkName` prop to set the initial alphabet of the `AvatarNetwork`. This will be used as the fallback display if no image url is passed to the `networkImageUrl` prop.

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

###  Network Image Url

Use the `networkImageUrl` prop to set the image to be rendered of the `AvatarNetwork`.

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

### Show Halo

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

<Canvas>
  <Story id="ui-components-component-library-avatar-network-avatar-network-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-network-avatar-network-stories-js--color-background-color-and-border-color" />
</Canvas>