import PropTypes from 'prop-types';
import IconMap from './IconMap';

/**
 * 图标兼容组件
 * @type {any}
 */
function Icon({ type, ...otherProps }: any) {
  const ICON = IconMap[type];
  if (ICON) return <ICON {...otherProps} />;
  return null;
}

Icon.propTypes = {
  type: PropTypes.string.isRequired,
};

export default Icon;
