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/base-avatar
Nidhi Kumari 194f7c8dd8
added AvatarBase Component (#15307)
* added AvatarBase Component

* added README file to storybook

* converted avatar-base to base-avatar

* props for snapshot testing

* replaced snapshot testing

* Updates to stories and component

* used arrow function for component

* fixed merge conflicts

* removed box stories

* changed import order for scss files

* replaced base-avatar import with component scss file

Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
2022-08-01 15:14:33 +05:30
..
base-avatar.js added AvatarBase Component (#15307) 2022-08-01 15:14:33 +05:30
base-avatar.scss added AvatarBase Component (#15307) 2022-08-01 15:14:33 +05:30
base-avatar.stories.js added AvatarBase Component (#15307) 2022-08-01 15:14:33 +05:30
base-avatar.test.js added AvatarBase Component (#15307) 2022-08-01 15:14:33 +05:30
index.js added AvatarBase Component (#15307) 2022-08-01 15:14:33 +05:30
README.mdx added AvatarBase Component (#15307) 2022-08-01 15:14:33 +05:30

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

import { BaseAvatar } from './base-avatar';

### This is a base component. It should not be used in your feature code directly but as a "base" for other UI components

# BaseAvatar

The `BaseAvatar` is a wrapper component responsible for enforcing dimensions and border radius for Avatar components

<Canvas>
  <Story id="ui-components-component-library-base-avatar-base-avatar-stories-js--default-story" />
</Canvas>

## Props

The `BaseAvatar` accepts all props below as well as all [Box](/ui-components-ui-box-box-stories-js--default-story) component props.

<ArgsTable of={BaseAvatar} />

### Size

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

Possible sizes include:

- `xs` 16px
- `sm` 24px
- `md` 32px
- `lg` 40px
- `xl` 48px

Defaults to `md`

<Canvas>
  <Story id="ui-components-component-library-base-avatar-base-avatar-stories-js--size" />
</Canvas>

### Children

The `BaseAvatar` component can contain images, icons or text

<Canvas>
  <Story id="ui-components-component-library-base-avatar-base-avatar-stories-js--children" />
</Canvas>

### Background and border color

Use the `backgroundColor` and `borderColor` prop to set the background and border colors of the avatar

<Canvas>
  <Story id="ui-components-component-library-base-avatar-base-avatar-stories-js--background-and-border-color" />
</Canvas>