2021-02-16 11:27:13 +01:00
|
|
|
import PropTypes from 'prop-types';
|
2020-08-04 08:20:35 +02:00
|
|
|
import classNames from 'classnames';
|
|
|
|
import styles from './Icon.module.css';
|
|
|
|
|
2021-02-16 11:27:13 +01:00
|
|
|
function Icon({ icon, className, size = 'medium', ...props }) {
|
2020-08-06 08:03:07 +02:00
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className={classNames(styles.icon, className, {
|
2020-08-09 08:48:43 +02:00
|
|
|
[styles.xlarge]: size === 'xlarge',
|
|
|
|
[styles.large]: size === 'large',
|
|
|
|
[styles.medium]: size === 'medium',
|
|
|
|
[styles.small]: size === 'small',
|
2020-08-09 12:04:48 +02:00
|
|
|
[styles.xsmall]: size === 'xsmall',
|
2020-08-06 08:03:07 +02:00
|
|
|
})}
|
2020-09-13 10:26:54 +02:00
|
|
|
{...props}
|
2020-08-06 08:03:07 +02:00
|
|
|
>
|
|
|
|
{icon}
|
|
|
|
</div>
|
|
|
|
);
|
2020-08-04 08:20:35 +02:00
|
|
|
}
|
2021-02-16 11:27:13 +01:00
|
|
|
|
|
|
|
Icon.propTypes = {
|
|
|
|
className: PropTypes.string,
|
|
|
|
icon: PropTypes.node.isRequired,
|
|
|
|
size: PropTypes.oneOf(['xlarge', 'large', 'medium', 'small', 'xsmall']),
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Icon;
|