Files
cinny/src/app/atoms/chip/Chip.jsx
T

38 lines
812 B
React
Raw Normal View History

2021-09-20 11:02:15 -05:00
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,
2021-10-18 17:25:52 +02:00
onClick,
2021-09-20 11:02:15 -05:00
}) {
return (
2021-10-18 17:25:52 +02:00
<button className="chip" type="button" onClick={onClick}>
{iconSrc != null && <RawIcon src={iconSrc} color={iconColor} size="extra-small" />}
{(text != null && text !== '') && <Text variant="b3">{text}</Text>}
2021-09-20 11:02:15 -05:00
{children}
2021-10-18 17:25:52 +02:00
</button>
2021-09-20 11:02:15 -05:00
);
}
Chip.propTypes = {
iconSrc: PropTypes.string,
iconColor: PropTypes.string,
text: PropTypes.string,
children: PropTypes.element,
2021-10-18 17:25:52 +02:00
onClick: PropTypes.func,
2021-09-20 11:02:15 -05:00
};
Chip.defaultProps = {
iconSrc: null,
iconColor: null,
text: null,
children: null,
2021-10-18 17:25:52 +02:00
onClick: null,
2021-09-20 11:02:15 -05:00
};
export default Chip;