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>
2023-01-20 20:27:46 +01:00
<Story id="components-componentlibrary-avatarnetwork--default-story" />
2022-08-18 20:54:10 +02:00
</Canvas>
## Props
2023-01-20 20:27:46 +01:00
The `AvatarNetwork` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) component props
2022-08-18 20:54:10 +02:00
<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>
2023-02-14 18:33:04 +01:00
<Story id="components-componentlibrary-avatarnetwork--size-story" />
2022-08-18 20:54:10 +02:00
</Canvas>
2022-12-15 18:28:42 +01:00
```jsx
2023-02-02 21:15:26 +01:00
import { Size } from '../../../helpers/constants/design-system';
2022-12-15 18:28:42 +01:00
import { AvatarNetwork } from '../../component-library';
2023-02-02 21:15:26 +01:00
<AvatarNetwork size={Size.XS} />
<AvatarNetwork size={Size.SM} />
<AvatarNetwork size={Size.MD} />
<AvatarNetwork size={Size.LG} />
<AvatarNetwork size={Size.XL} />
2022-12-15 18:28:42 +01:00
```
2022-08-18 20:54:10 +02:00
2023-02-02 21:15:26 +01:00
### Name
2022-12-15 18:28:42 +01:00
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>
2023-01-20 20:27:46 +01:00
<Story id="components-componentlibrary-avatarnetwork--name" />
2022-08-18 20:54:10 +02:00
</Canvas>
2022-12-15 18:28:42 +01:00
```jsx
import { AvatarNetwork } from '../../component-library';
2023-02-02 21:15:26 +01:00
<AvatarNetwork name="Arbitrum One" />;
2022-12-15 18:28:42 +01:00
```
2023-02-02 21:15:26 +01:00
### 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>
2023-01-20 20:27:46 +01:00
<Story id="components-componentlibrary-avatarnetwork--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>
2023-01-20 20:27:46 +01:00
<Story id="components-componentlibrary-avatarnetwork--show-halo" />
2022-08-18 20:54:10 +02:00
</Canvas>
2022-12-15 18:28:42 +01:00
```jsx
import { AvatarNetwork } from '../../component-library';
2023-02-02 21:15:26 +01:00
<AvatarNetwork src="./images/arbitrum.svg" showHalo />;
2022-12-15 18:28:42 +01:00
```
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>
2023-01-20 20:27:46 +01:00
<Story id="components-componentlibrary-avatarnetwork--color-background-color-and-border-color" />
2022-12-15 18:28:42 +01:00
</Canvas>
```jsx
2023-02-02 21:15:26 +01:00
import { TextColor,
BackgroundColor,
BorderColor } from '../../../helpers/constants/design-system';
2022-12-15 18:28:42 +01:00
import { AvatarNetwork } from '../../component-library';
<AvatarNetwork
2023-02-02 21:15:26 +01:00
backgroundColor={BackgroundColor.goerli}
borderColor={BorderColor.goerli}
name="G"
color={Color.goerliInverse}
2022-12-15 18:28:42 +01:00
>
G
</AvatarNetwork>
<AvatarNetwork
2023-02-02 21:15:26 +01:00
backgroundColor={BackgroundColor.sepolia}
borderColor={BorderColor.sepolia}
name="S"
color={Color.goerliInverse}
2022-12-15 18:28:42 +01:00
>
S
</AvatarNetwork>
2023-02-02 21:15:26 +01:00
```