2022-08-18 20:54:10 +02:00
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>
2022-12-15 18:28:42 +01:00
```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} />
```
2022-08-18 20:54:10 +02:00
2022-12-15 18:28:42 +01:00
### 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.
2022-08-18 20:54:10 +02:00
<Canvas>
2022-12-15 18:28:42 +01:00
<Story id="ui-components-component-library-avatar-network-avatar-network-stories-js--name" />
2022-08-18 20:54:10 +02:00
</Canvas>
2022-12-15 18:28:42 +01:00
```jsx
import { AvatarNetwork } from '../../component-library';
<AvatarNetwork name="Arbitrum One" />
```
### Src
2022-08-18 20:54:10 +02:00
2022-12-15 18:28:42 +01:00
Use the `src` prop to set the image to be rendered of the `AvatarNetwork`.
2022-08-18 20:54:10 +02:00
<Canvas>
2022-12-15 18:28:42 +01:00
<Story id="ui-components-component-library-avatar-network-avatar-network-stories-js--src" />
2022-08-18 20:54:10 +02:00
</Canvas>
2022-12-15 18:28:42 +01:00
```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" />
```
2022-08-18 20:54:10 +02:00
### Show Halo
2022-12-15 18:28:42 +01:00
Use the `showHalo` prop to display the component with halo effect. Only works if an image url is supplied to `src`
2022-08-18 20:54:10 +02:00
<Canvas>
<Story id="ui-components-component-library-avatar-network-avatar-network-stories-js--show-halo" />
</Canvas>
2022-12-15 18:28:42 +01:00
```jsx
import { AvatarNetwork } from '../../component-library';
<AvatarNetwork src="./images/arbitrum.svg" showHalo/>
```
2022-08-18 20:54:10 +02:00
### Color, Background Color And Border Color
2022-12-15 18:28:42 +01:00
Use the `color`, `backgroundColor` and `borderColor` props to set the text color, background-color and border-color of the `AvatarNetwork`.
2022-08-18 20:54:10 +02:00
<Canvas>
<Story id="ui-components-component-library-avatar-network-avatar-network-stories-js--color-background-color-and-border-color" />
2022-12-15 18:28:42 +01:00
</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>
```