UNPKG

@nomios/web-uikit

Version:
24 lines 631 B
import React, { forwardRef } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import Svg from '../svg'; import styles from './Icon.css'; const Icon = forwardRef((props, ref) => { const { className, ...rest } = props; const finalProps = { ...rest, className: classNames(styles.icon, className) }; return React.createElement(Svg, Object.assign({ ref: ref }, finalProps)); }); Icon.propTypes = { svg: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({ then: PropTypes.func.isRequired })]).isRequired, className: PropTypes.string }; export default Icon;