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>
<Story id="ui-components-component-library-avatar-favicon-avatar-favicon-stories-js--default-story" />
</Canvas>
## Props
The `AvatarFavicon` accepts all props below as well as all [Box](/docs/ui-components-ui-box-box-stories-js--default-story) component props
<ArgsTable of={AvatarFavicon} />
2023-01-11 17:11:06 +01:00
`AvatarFavicon` accepts all [AvatarBase](/docs/ui-components-component-library-avatar-base-avatar-base-stories-js--default-story#props)
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-01-11 17:11:06 +01:00
Optional: `AVATAR_FAVICON_SIZES` from `./ui/components/component-library` object can be used instead of `SIZES`
2022-10-13 01:22:21 +02:00
Possible sizes include:
2023-01-11 17:11:06 +01:00
- `SIZES.XS` 16px
- `SIZES.SM` 24px
- `SIZES.MD` 32px
- `SIZES.LG` 40px
- `SIZES.XL` 48px
2022-10-13 01:22:21 +02:00
2023-01-11 17:11:06 +01:00
Defaults to `SIZES.MD`
2022-10-13 01:22:21 +02:00
<Canvas>
<Story id="ui-components-component-library-avatar-favicon-avatar-favicon-stories-js--size" />
</Canvas>
2023-01-11 17:11:06 +01:00
```jsx
import { SIZES } from '../../../helpers/constants/design-system';
import { AvatarFavicon } from '../ui/component-library';
<AvatarFavicon size={SIZES.XS} />
<AvatarFavicon size={SIZES.SM} />
<AvatarFavicon size={SIZES.MD} />
<AvatarFavicon size={SIZES.LG} />
<AvatarFavicon size={SIZES.XL} />
```
### Src
Use the `src` prop to set the image to be rendered of the `AvatarFavicon`.
<Canvas>
<Story id="ui-components-component-library-avatar-favicon-avatar-favicon-stories-js--src" />
</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-11 17:11:06 +01:00
If there is no `src` then in that case an [icon](/docs/ui-components-component-library-icon-icon-stories-js--default-story) will be used as the fallback display and it can be customised via `fallbackIconProps`.
2022-10-13 01:22:21 +02:00