2022-10-13 01:22:21 +02:00
import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';
2023-01-11 17:11:06 +01:00
import { AvatarBase } from '../';
2022-10-13 01:22:21 +02:00
import { AvatarFavicon } from './avatar-favicon';
# AvatarFavicon
The `AvatarFavicon` is an image component that renders an icon that is provided in the form of a URL.
<Canvas>
2023-01-20 20:27:46 +01:00
<Story id="components-componentlibrary-avatarfavicon--default-story" />
2022-10-13 01:22:21 +02:00
</Canvas>
## Props
2023-01-20 20:27:46 +01:00
The `AvatarFavicon` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) component props
2022-10-13 01:22:21 +02:00
<ArgsTable of={AvatarFavicon} />
2023-01-20 20:27:46 +01:00
`AvatarFavicon` accepts all [AvatarBase](components-componentlibrary-avatarbase--default-story))
2023-01-11 17:11:06 +01:00
component props
<ArgsTable of={AvatarBase} />
2022-10-13 01:22:21 +02:00
### Size
Use the `size` prop to set the size of the `AvatarFavicon`.
2023-02-02 21:15:26 +01:00
Optional: `AVATAR_FAVICON_SIZES` from `./ui/components/component-library` object can be used instead of `Size`
2023-01-11 17:11:06 +01:00
2022-10-13 01:22:21 +02:00
Possible sizes include:
2023-02-02 21:15:26 +01:00
- `Size.XS` 16px
- `Size.SM` 24px
- `Size.MD` 32px
- `Size.LG` 40px
- `Size.XL` 48px
2022-10-13 01:22:21 +02:00
2023-02-14 18:33:04 +01:00
Defaults to `Size.MD`
2022-10-13 01:22:21 +02:00
<Canvas>
2023-02-14 18:33:04 +01:00
<Story id="components-componentlibrary-avatarfavicon--size-story" />
2022-10-13 01:22:21 +02:00
</Canvas>
2023-01-11 17:11:06 +01:00
```jsx
2023-02-02 21:15:26 +01:00
import { Size } from '../../../helpers/constants/design-system';
2023-01-11 17:11:06 +01:00
import { AvatarFavicon } from '../ui/component-library';
2023-02-02 21:15:26 +01:00
<AvatarFavicon size={Size.XS} />
<AvatarFavicon size={Size.SM} />
<AvatarFavicon size={Size.MD} />
<AvatarFavicon size={Size.LG} />
<AvatarFavicon size={Size.XL} />
2023-01-11 17:11:06 +01:00
```
### Src
Use the `src` prop to set the image to be rendered of the `AvatarFavicon`.
<Canvas>
2023-01-20 20:27:46 +01:00
<Story id="components-componentlibrary-avatarfavicon--src" />
2023-01-11 17:11:06 +01:00
</Canvas>
```jsx
import { AvatarFavicon } from '../ui/component-library';
2022-10-13 01:22:21 +02:00
2023-01-11 17:11:06 +01:00
<AvatarFavicon src="https://uniswap.org/favicon.ico" />
<AvatarFavicon src="https://1inch.exchange/assets/favicon/favicon-32x32.png" />
```
2022-10-13 01:22:21 +02:00
### Fallback Icon Props
2023-01-20 20:27:46 +01:00
If there is no `src` then in that case an [icon](/docs/components-componentlibrary-icon--default-story) will be used as the fallback display and it can be customised via `fallbackIconProps`.