1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/components/component-library/base-avatar/base-avatar.js
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

45 lines
1.1 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import Box from '../../ui/box/box';
import { COLORS, SIZES } from '../../../helpers/constants/design-system';
export const BaseAvatar = ({
size = SIZES.MD,
children,
backgroundColor = COLORS.BACKGROUND_ALTERNATIVE,
borderColor = COLORS.BORDER_DEFAULT,
...props
}) => (
<Box
className={classnames('base-avatar', `base-avatar--size-${size}`)}
{...{ backgroundColor, borderColor, ...props }}
>
{children}
</Box>
);
BaseAvatar.propTypes = {
/**
* The size of the BaseAvatar.
* Possible values could be 'xs', 'sm', 'md', 'lg', 'xl',
*/
size: PropTypes.oneOf(Object.values(SIZES)),
/**
* The children to be rendered inside the BaseAvatar
*/
children: PropTypes.node,
/**
* The background color of the BaseAvatar
*/
backgroundColor: Box.propTypes.backgroundColor,
/**
* The background color of the BaseAvatar
*/
borderColor: Box.propTypes.borderColor,
/**
* BaseAvatar accepts all the props from Box
*/
...Box.propTypes,
};