1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 15:50:28 +01:00
metamask-extension/ui/components/component-library/avatar-favicon
George Marshall 5d17f86e02
Update Text import paths: component library/ (#19987)
* Updating component-librar import paths

* Updating snapshots

* Updates to AvatarBase story

* Updates to avatar and checkbox

* Updating last of the deprecated import paths

* Updating component-library snapshots from button-base

* Updating snapshots from rest of codebase to do with button-base

* Removing unneeded CSS

* Updating snapshots
2023-07-17 14:00:16 -07:00
..
__snapshots__ Update Text import paths: component library/ (#19987) 2023-07-17 14:00:16 -07:00
avatar-favicon.constants.js feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
avatar-favicon.js Part of #18714: Replacing deprecated constants in Avatar-Favicon folder (#19332) 2023-06-01 10:09:08 -07:00
avatar-favicon.scss housekeeping for Avatar Favicon (#16931) 2023-01-11 21:41:06 +05:30
avatar-favicon.stories.js Part of #18714: Replacing deprecated constants in Avatar-Favicon folder (#19332) 2023-06-01 10:09:08 -07:00
avatar-favicon.test.js Updating Avatar components to forward refs (#18678) 2023-04-21 08:51:34 -07:00
index.js housekeeping for Avatar Favicon (#16931) 2023-01-11 21:41:06 +05:30
README.mdx fix broken stories and readme from TS update (#17703) 2023-02-14 11:33:04 -06:00

import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';

import { AvatarBase } from '../';

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="components-componentlibrary-avatarfavicon--default-story" />
</Canvas>

## Props

The `AvatarFavicon` accepts all props below as well as all [Box](/docs/components-ui-box--default-story#props) component props

<ArgsTable of={AvatarFavicon} />

`AvatarFavicon` accepts all [AvatarBase](components-componentlibrary-avatarbase--default-story))
component props

<ArgsTable of={AvatarBase} />

### Size

Use the `size` prop to set the size of the `AvatarFavicon`.

Optional: `AVATAR_FAVICON_SIZES` from `./ui/components/component-library` object can be used instead of `Size`

Possible sizes include:

- `Size.XS` 16px
- `Size.SM` 24px
- `Size.MD` 32px
- `Size.LG` 40px
- `Size.XL` 48px

Defaults to `Size.MD`

<Canvas>
  <Story id="components-componentlibrary-avatarfavicon--size-story" />
</Canvas>

```jsx
import { Size } from '../../../helpers/constants/design-system';
import { AvatarFavicon } from '../ui/component-library';

<AvatarFavicon size={Size.XS} />
<AvatarFavicon size={Size.SM} />
<AvatarFavicon size={Size.MD} />
<AvatarFavicon size={Size.LG} />
<AvatarFavicon size={Size.XL} />
```

### Src

Use the `src` prop to set the image to be rendered of the `AvatarFavicon`.

<Canvas>
  <Story id="components-componentlibrary-avatarfavicon--src" />
</Canvas>

```jsx
import { AvatarFavicon } from '../ui/component-library';

<AvatarFavicon src="https://uniswap.org/favicon.ico" />
<AvatarFavicon src="https://1inch.exchange/assets/favicon/favicon-32x32.png" />
```

### Fallback Icon Props

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`.