1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 08:09:15 +01:00
metamask-extension/ui/components/component-library/badge-wrapper/badge-wrapper.tsx

45 lines
1.1 KiB
TypeScript
Raw Normal View History

import React from 'react';
import classnames from 'classnames';
import { DISPLAY } from '../../../helpers/constants/design-system';
import Box from '../../ui/box';
import {
BadgeWrapperPosition,
BadgeWrapperAnchorElementShape,
BadgeWrapperProps,
} from './badge-wrapper.types';
export const BadgeWrapper = ({
children,
badge,
badgeContainerProps,
position = BadgeWrapperPosition.topRight,
positionObj,
anchorElementShape = BadgeWrapperAnchorElementShape.circular,
className = '',
color,
...props
}: BadgeWrapperProps) => (
<Box
className={classnames('mm-badge-wrapper', className)}
display={DISPLAY.INLINE_BLOCK}
{...props}
>
{/* Generally the AvatarAccount or AvatarToken */}
{children}
<Box
className={classnames('mm-badge-wrapper__badge-container', {
[`mm-badge-wrapper__badge-container--${anchorElementShape}-${position}`]:
!positionObj,
})}
style={{ ...positionObj }}
{...badgeContainerProps}
>
{/* Generally the AvatarNetwork at SIZES.XS */}
{badge}
</Box>
</Box>
);