mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-03 06:34:27 +01:00
4fcbaae32f
* added housekeeping for avatar network * fixed alt * updated story in Readme * fixed indentation and added network src * updated SIZES for avatar network * updated snapshot * updated docs and props * updated name of avatar * removed comments * updated avatar network component * updated readme * updated story for badge * added constants to the root
121 lines
3.3 KiB
Plaintext
121 lines
3.3 KiB
Plaintext
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>
|
|
|
|
```jsx
|
|
import { SIZES } from '../../../helpers/constants/design-system';
|
|
import { AvatarNetwork } from '../../component-library';
|
|
<AvatarNetwork size={SIZES.XS} />
|
|
<AvatarNetwork size={SIZES.SM} />
|
|
<AvatarNetwork size={SIZES.MD} />
|
|
<AvatarNetwork size={SIZES.LG} />
|
|
<AvatarNetwork size={SIZES.XL} />
|
|
```
|
|
|
|
### Name
|
|
|
|
Use the `name` prop to set the initial letter of the `AvatarNetwork`. This will be used as the fallback display if no image url is passed to the `src` prop.
|
|
|
|
<Canvas>
|
|
<Story id="ui-components-component-library-avatar-network-avatar-network-stories-js--name" />
|
|
</Canvas>
|
|
|
|
```jsx
|
|
import { AvatarNetwork } from '../../component-library';
|
|
<AvatarNetwork name="Arbitrum One" />
|
|
```
|
|
|
|
### Src
|
|
|
|
Use the `src` prop to set the image to be rendered of the `AvatarNetwork`.
|
|
|
|
<Canvas>
|
|
<Story id="ui-components-component-library-avatar-network-avatar-network-stories-js--src" />
|
|
</Canvas>
|
|
|
|
```jsx
|
|
import { AvatarNetwork } from '../../component-library';
|
|
<AvatarNetwork src="./images/matic-token.png" />
|
|
<AvatarNetwork src="./images/arbitrum.svg" />
|
|
<AvatarNetwork src="./images/optimism.svg" />
|
|
<AvatarNetwork src="./images/avax-token.png" />
|
|
<AvatarNetwork src="./images/palm.svg" />
|
|
<AvatarNetwork src="./images/bsc-filled.svg" />
|
|
<AvatarNetwork src="./images/fantom-opera.svg" />
|
|
<AvatarNetwork src="./images/harmony-one.svg" />
|
|
<AvatarNetwork src="./images/aurora.png" />
|
|
```
|
|
|
|
### Show Halo
|
|
|
|
Use the `showHalo` prop to display the component with halo effect. Only works if an image url is supplied to `src`
|
|
|
|
<Canvas>
|
|
<Story id="ui-components-component-library-avatar-network-avatar-network-stories-js--show-halo" />
|
|
</Canvas>
|
|
|
|
```jsx
|
|
import { AvatarNetwork } from '../../component-library';
|
|
<AvatarNetwork src="./images/arbitrum.svg" showHalo/>
|
|
```
|
|
|
|
### 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 `AvatarNetwork`.
|
|
|
|
<Canvas>
|
|
<Story id="ui-components-component-library-avatar-network-avatar-network-stories-js--color-background-color-and-border-color" />
|
|
</Canvas>
|
|
|
|
```jsx
|
|
import { COLORS } from '../../../helpers/constants/design-system';
|
|
import { AvatarNetwork } from '../../component-library';
|
|
<AvatarNetwork
|
|
backgroundColor={COLORS.GOERLI}
|
|
borderColor={COLORS.GOERLI}
|
|
name="G"
|
|
color={COLORS.PRIMARY_INVERSE}
|
|
>
|
|
G
|
|
</AvatarNetwork>
|
|
<AvatarNetwork
|
|
backgroundColor={COLORS.SEPOLIA}
|
|
borderColor={COLORS.SEPOLIA}
|
|
name="S"
|
|
color={COLORS.PRIMARY_INVERSE}
|
|
>
|
|
S
|
|
</AvatarNetwork>
|
|
``` |