1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-05 23:44:56 +01:00
metamask-extension/ui/components/component-library/avatar-with-badge
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__ AvatarWithBadge Housekeeping (#16985) 2022-12-22 00:36:40 +05:30
avatar-with-badge.constants.js AvatarWithBadge Housekeeping (#16985) 2022-12-22 00:36:40 +05:30
avatar-with-badge.js AvatarWithBadge Housekeeping (#16985) 2022-12-22 00:36:40 +05:30
avatar-with-badge.scss AvatarWithBadge Housekeeping (#16985) 2022-12-22 00:36:40 +05:30
avatar-with-badge.stories.js Added storybook check to CI (#17092) 2023-01-21 00:57:46 +05:30
avatar-with-badge.test.js AvatarWithBadge Housekeeping (#16985) 2022-12-22 00:36:40 +05:30
index.js AvatarWithBadge Housekeeping (#16985) 2022-12-22 00:36:40 +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 { AvatarWithBadge } from './avatar-with-badge';

# AvatarWithBadge

The `AvatarWithBadge` is a wrapper component that adds badge display options to avatars.

<Canvas>
  <Story id="components-componentlibrary-avatarwithbadge--default-story" />
</Canvas>

## Props

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

<ArgsTable of={AvatarWithBadge} />

### Badge Position

Use the `badgePosition` prop to set the position of the badge, it can have two values `Top` and `Bottom`

<Canvas>
  <Story id="components-componentlibrary-avatarwithbadge--badge-position" />
</Canvas>

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

<AvatarWithBadge
  badgePosition={AVATAR_WITH_BADGE_POSTIONS.BOTTOM}
  badge={
    <AvatarNetwork
      size={SIZES.XS}
      name="Arbitrum One"
      src="./images/arbitrum.svg"
    />
  }
>
  <AvatarAccount
    address="0x5CfE73b6021E818B776b421B1c4Db2474086a7e1"
    size={SIZES.MD}
    type={TYPES.JAZZICON}
  />
</AvatarWithBadge>

<AvatarWithBadge
  badgePosition={AVATAR_WITH_BADGE_POSTIONS.TOP}
  badge={
    <AvatarNetwork
      size={SIZES.XS}
      name="Arbitrum One"
      src="./images/arbitrum.svg"
    />
  }
>
  <AvatarAccount
    address="0x5CfE73b6021E818B776b421B1c4Db2474086a7e1"
    size={SIZES.MD}
    type={TYPES.JAZZICON}
  />
</AvatarWithBadge>
```

### Badge

Used to define the badge component to be rendered inside the `AvatarWithBadge`.

### Badge Props

The required props to be passed to the badge.

### Children

The children to be rendered inside the AvatarWithBadge. Generally used with the `AvatarAccount`