mirror of
https://github.com/cinnyapp/cinny.git
synced 2024-11-20 14:59:55 +01:00
commit
90ab8dac27
2 changed files with 53 additions and 0 deletions
34
src/app/atoms/chip/Chip.jsx
Normal file
34
src/app/atoms/chip/Chip.jsx
Normal 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;
|
19
src/app/atoms/chip/Chip.scss
Normal file
19
src/app/atoms/chip/Chip.scss
Normal file
|
@ -0,0 +1,19 @@
|
|||
.chip {
|
||||
padding: var(--sp-ultra-tight) var(--sp-extra-tight);
|
||||
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
background: var(--bg-surface-low);
|
||||
border-radius: var(--bo-radius);
|
||||
border: 1px solid var(--bg-surface-border);
|
||||
|
||||
& > .ic-raw {
|
||||
margin-right: var(--sp-extra-tight);
|
||||
[dir=rtl] & {
|
||||
margin-right: 0;
|
||||
margin-left: var(--sp-extra-tight);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue