/* eslint-disable linebreak-style */ import React from 'react'; import collection, { TIconType } from './collection'; import styles from './Icon.styles'; import type { IconProps } from './types'; const { StyledIconDiv } = styles; const Icon: React.FC = ({ fill = 'inherit', size = 18, svg, style, ...props }) => { const getIcon = ( fill: string, size: number, svg: TIconType, style?: React.CSSProperties, ) => { const key = (svg + 'Icon') as keyof typeof collection; if (!collection[key]) throw new Error(`no icon found: '${key}'`); return collection[key](fill, size, style); }; return {getIcon(fill, size, svg, style)}; }; export default Icon;