Added chip component.

This commit is contained in:
jamesjulich 2021-09-20 11:02:15 -05:00
parent 470fdd62bb
commit 26f68a890e
2 changed files with 57 additions and 0 deletions

View file

@ -0,0 +1,34 @@
import React from 'react';
import PropTypes from 'prop-types';
import './Chip.scss';
import Text from '../text/Text';
import RawIcon from '../system-icons/RawIcon';
function Chip({
iconSrc, iconColor, text, children,
}) {
return (
<div className="chip">
{iconSrc != null && <RawIcon src={iconSrc} color={iconColor} size="small" />}
{(text != null && text !== '') && <Text variant="b2">{text}</Text>}
{children}
</div>
);
}
Chip.propTypes = {
iconSrc: PropTypes.string,
iconColor: PropTypes.string,
text: PropTypes.string,
children: PropTypes.element,
};
Chip.defaultProps = {
iconSrc: null,
iconColor: null,
text: null,
children: null,
};
export default Chip;

View file

@ -0,0 +1,23 @@
.chip {
height: 28px;
width: fit-content;
width: -moz-fit-content;
background: var(--bg-surface-low);
display: flex;
flex-direction: row;
align-items: center;
padding: var(--sp-ultra-tight) var(--sp-extra-tight);
box-sizing: border-box;
border-radius: var(--bo-radius);
border: 1px solid var(--bg-surface-border);
& .text-b2 {
color: var(--tc-surface-high);
}
& .ic-raw-small {
margin-right: var(--sp-extra-tight);
}
}