mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-02 14:15:06 +01:00
f8881a01db
* updated classnames * updated readme and tests for avatar with badge * updated constants in root * replacing BADGE_POSITIONS with AVATAR_WITH_BADGE_BADGE_POSITIONS |
||
---|---|---|
.. | ||
__snapshots__ | ||
avatar-with-badge.constants.js | ||
avatar-with-badge.js | ||
avatar-with-badge.scss | ||
avatar-with-badge.stories.js | ||
avatar-with-badge.test.js | ||
index.js | ||
README.mdx |
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="ui-components-component-library-avatar-with-badge-avatar-with-badge-stories-js--default-story" /> </Canvas> ## Props The `AvatarWithBadge` accepts all props below as well as all [Box](/docs/ui-components-ui-box-box-stories-js--default-story) 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="ui-components-component-library-avatar-with-badge-avatar-with-badge-stories-js--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`