import warning from 'warning'; import { SvgIconProps } from './utils/SVGIcon'; import * as icons from './icons'; const { NODE_ENV } = process.env; let warnOnce = false; export interface IconProps extends SvgIconProps { type?: string; } const Icon = ({ type = '', color = 'currentColor', size = 20, style = {}, verticalAlign = 'middle', viewBox = '0 0 217 217', title = '', }: IconProps) => { if (NODE_ENV !== 'production') { warning( warnOnce, [ 'Generic Icon would be deprecated in v1.', 'Please switch to exact name import before migrating to v1', `e.g. import { up } from '@lalamove/karang/dist/components/Icon/icons';`, `/ import Up from '@lalamove/karang/dist/components/Icon/icons/arrows/arrow/up';`, ].join('\n') ); warnOnce = true; } const I = icons[type]; const iconProps = { color, size, style, verticalAlign, viewBox, title, }; return ; }; export default Icon;