mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
* Removing all COLORS.UI 1,2,3,4 from codebase * Removing all unused versions of COLORS.GREY, COLORS.WHITE and some left over UI1,UI2,UI3,UI4 in docs
61 lines
1.2 KiB
JavaScript
61 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import Box from '../box';
|
|
import {
|
|
BORDER_STYLE,
|
|
COLORS,
|
|
SIZES,
|
|
} from '../../../helpers/constants/design-system';
|
|
|
|
const Card = ({
|
|
border = true,
|
|
padding = 4,
|
|
backgroundColor = COLORS.BACKGROUND_DEFAULT,
|
|
children,
|
|
...props
|
|
}) => {
|
|
const defaultBorderProps = {
|
|
borderColor: border && COLORS.BORDER_MUTED,
|
|
borderRadius: border && SIZES.MD,
|
|
borderStyle: border && BORDER_STYLE.SOLID,
|
|
};
|
|
|
|
return (
|
|
<Box
|
|
{...{
|
|
padding,
|
|
backgroundColor,
|
|
...defaultBorderProps,
|
|
...props,
|
|
}}
|
|
>
|
|
{children}
|
|
</Box>
|
|
);
|
|
};
|
|
|
|
Card.propTypes = {
|
|
/**
|
|
* Whether the Card has a border or not.
|
|
* Defaults to true
|
|
*/
|
|
border: PropTypes.bool,
|
|
/**
|
|
* Padding of the Card component accepts number or an array of 2 numbers.
|
|
* Defaults to 4 (16px)
|
|
*/
|
|
padding: Box.propTypes.padding,
|
|
/**
|
|
* The background color of the card
|
|
* Defaults to COLORS.BACKGROUND_DEFAULT
|
|
*/
|
|
backgroundColor: Box.propTypes.backgroundColor,
|
|
/**
|
|
* The Card component accepts all Box component props
|
|
*/
|
|
...Box.propTypes,
|
|
};
|
|
|
|
export default Card;
|