import * as React from 'react'; import withIconSvg from '../helpers/withIconSvg'; /** * Note: need to export interface to avoid error in Icons namespace. */ export interface Props { size?: 's' | 'm' | 'l'; } const renderIconSmall = (props: Props) => ( ); const renderIconMedium = (props: Props) => ( ); const renderIconLarge = (props: Props) => ( ); const Icon: React.FC = (props) => (( { l: renderIconLarge(props), m: renderIconMedium(props), s: renderIconSmall(props), } as { [key in NonNullable]: JSX.Element } )[props.size!] || // @ts-ignore !console.log(`Invalid prop option passed to switch statement for this icon with props`, props)); Icon.defaultProps = { size: 's', } as Partial; export default withIconSvg(Icon, true, { additionalProps: [ { propName: 'size', type: 'select', options: ['s', 'm', 'l'], // todo: how to automatically get these options??? default: Icon.defaultProps.size, }, ], tags: ['close', 'dismiss', 'x'], });