feature(components): prop-type Icon component

This commit is contained in:
Alexander Klein 2021-02-16 11:27:13 +01:00
parent 30ebf7b266
commit d9a7b27f0e

View File

@ -1,8 +1,9 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import styles from './Icon.module.css'; import styles from './Icon.module.css';
export default function Icon({ icon, className, size = 'medium', ...props }) { function Icon({ icon, className, size = 'medium', ...props }) {
return ( return (
<div <div
className={classNames(styles.icon, className, { className={classNames(styles.icon, className, {
@ -18,3 +19,11 @@ export default function Icon({ icon, className, size = 'medium', ...props }) {
</div> </div>
); );
} }
Icon.propTypes = {
className: PropTypes.string,
icon: PropTypes.node.isRequired,
size: PropTypes.oneOf(['xlarge', 'large', 'medium', 'small', 'xsmall']),
};
export default Icon;