umami/components/common/Icon.js

30 lines
745 B
JavaScript
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import styles from './Icon.module.css';
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>
);
}
Icon.propTypes = {
className: PropTypes.string,
icon: PropTypes.node.isRequired,
size: PropTypes.oneOf(['xlarge', 'large', 'medium', 'small', 'xsmall']),
};
export default Icon;