From e1e46986d902adc4c19ee009016290f9733a7d61 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Mon, 5 Aug 2019 16:48:25 +0200 Subject: Enable tree shaking for icons --- packages/ui/src/icon/index.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'packages/ui/src/icon/index.tsx') diff --git a/packages/ui/src/icon/index.tsx b/packages/ui/src/icon/index.tsx index e30d3396d..af467c085 100644 --- a/packages/ui/src/icon/index.tsx +++ b/packages/ui/src/icon/index.tsx @@ -1,4 +1,3 @@ -import * as mdiIcons from '@mdi/js'; import MdiIcon from '@mdi/react'; import { Theme } from '@meetfranz/theme'; import classnames from 'classnames'; @@ -8,7 +7,7 @@ import injectStyle from 'react-jss'; import { IWithStyle } from '../typings/generic'; interface IProps extends IWithStyle { - icon: keyof typeof mdiIcons; + icon: string; size?: number; className?: string; } @@ -27,16 +26,13 @@ class IconComponent extends Component { render() { const { classes, - icon: iconName, + icon, size, className, } = this.props; - let icon = ''; - if (iconName && mdiIcons[iconName]) { - icon = mdiIcons[iconName]; - } else if (iconName && !mdiIcons[iconName]) { - console.warn(`Icon '${iconName}' was not found`); + if (!icon) { + console.warn('No Icon specified'); } return ( -- cgit v1.2.3-70-g09d2