1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 23:58:06 +01:00
metamask-extension/ui/components/component-library/avatar-favicon
Nidhi Kumari c5368c152b
Added storybook check to CI (#17092)
* added storybook test runner

* added test runner in ci

* updated test for ci and fixed lint error

* updated lavamoat policy

* updated test command

* updated playwright

* changed command to storybook;ci

* updated command

* updated instance for test-storybook

* updated playwright

* added playwright step

* replaced concurrently with start-server-and-test

* updated the static storybook directory

* replaced first with last

* updated lock file

* replaced first with last

* updated test-storybook with maxworkers

* updated .depchechrc

* updated yml

* removed id from banner base

* replaced broken stories with .stories-to-do.js extesnsion

* updated token allowance story

* removed duplicacies from yarn

* fixed lavamoat

* removed filename comment

* updated links for docs

* fixed file extension for stories

* updated path for stories.json

* updated stories.json path

* yarn updated

* updated stories

* updated yarn

* updated wait on
2023-01-21 00:57:46 +05:30
..
__snapshots__ housekeeping for Avatar Favicon (#16931) 2023-01-11 21:41:06 +05:30
avatar-favicon.constants.js housekeeping for Avatar Favicon (#16931) 2023-01-11 21:41:06 +05:30
avatar-favicon.js housekeeping for Avatar Favicon (#16931) 2023-01-11 21:41:06 +05:30
avatar-favicon.scss housekeeping for Avatar Favicon (#16931) 2023-01-11 21:41:06 +05:30
avatar-favicon.stories.js Added storybook check to CI (#17092) 2023-01-21 00:57:46 +05:30
avatar-favicon.test.js housekeeping for Avatar Favicon (#16931) 2023-01-11 21:41:06 +05:30
index.js housekeeping for Avatar Favicon (#16931) 2023-01-11 21:41:06 +05:30
README.mdx Added storybook check to CI (#17092) 2023-01-21 00:57:46 +05:30

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

Possible sizes include:

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

Defaults to `SIZES.MD`

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

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