aboutsummaryrefslogtreecommitdiffstats
path: root/packages/ui
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-08-05 16:48:25 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-08-05 16:48:25 +0200
commite1e46986d902adc4c19ee009016290f9733a7d61 (patch)
tree0f44c1c9b3d0ee2d4d5fa9086d5e7ac5bbfc5772 /packages/ui
parentbump version to 5.2.1-beta.1 (diff)
downloadferdium-app-e1e46986d902adc4c19ee009016290f9733a7d61.tar.gz
ferdium-app-e1e46986d902adc4c19ee009016290f9733a7d61.tar.zst
ferdium-app-e1e46986d902adc4c19ee009016290f9733a7d61.zip
Enable tree shaking for icons
Diffstat (limited to 'packages/ui')
-rw-r--r--packages/ui/src/badge/ProBadge.tsx3
-rw-r--r--packages/ui/src/icon/index.tsx12
-rw-r--r--packages/ui/src/infobox/index.tsx3
3 files changed, 8 insertions, 10 deletions
diff --git a/packages/ui/src/badge/ProBadge.tsx b/packages/ui/src/badge/ProBadge.tsx
index 612e23210..c18cb4a0c 100644
--- a/packages/ui/src/badge/ProBadge.tsx
+++ b/packages/ui/src/badge/ProBadge.tsx
@@ -1,3 +1,4 @@
1import { mdiStar } from '@mdi/js';
1import { Theme } from '@meetfranz/theme'; 2import { Theme } from '@meetfranz/theme';
2import classnames from 'classnames'; 3import classnames from 'classnames';
3import React, { Component } from 'react'; 4import React, { Component } from 'react';
@@ -49,7 +50,7 @@ class ProBadgeComponent extends Component<IProps> {
49 ])} 50 ])}
50 > 51 >
51 <Icon 52 <Icon
52 icon="mdiStar" 53 icon={mdiStar}
53 className={classnames([ 54 className={classnames([
54 classes.icon, 55 classes.icon,
55 inverted && classes.invertedIcon, 56 inverted && classes.invertedIcon,
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 @@
1import * as mdiIcons from '@mdi/js';
2import MdiIcon from '@mdi/react'; 1import MdiIcon from '@mdi/react';
3import { Theme } from '@meetfranz/theme'; 2import { Theme } from '@meetfranz/theme';
4import classnames from 'classnames'; 3import classnames from 'classnames';
@@ -8,7 +7,7 @@ import injectStyle from 'react-jss';
8import { IWithStyle } from '../typings/generic'; 7import { IWithStyle } from '../typings/generic';
9 8
10interface IProps extends IWithStyle { 9interface IProps extends IWithStyle {
11 icon: keyof typeof mdiIcons; 10 icon: string;
12 size?: number; 11 size?: number;
13 className?: string; 12 className?: string;
14} 13}
@@ -27,16 +26,13 @@ class IconComponent extends Component<IProps> {
27 render() { 26 render() {
28 const { 27 const {
29 classes, 28 classes,
30 icon: iconName, 29 icon,
31 size, 30 size,
32 className, 31 className,
33 } = this.props; 32 } = this.props;
34 33
35 let icon = ''; 34 if (!icon) {
36 if (iconName && mdiIcons[iconName]) { 35 console.warn('No Icon specified');
37 icon = mdiIcons[iconName];
38 } else if (iconName && !mdiIcons[iconName]) {
39 console.warn(`Icon '${iconName}' was not found`);
40 } 36 }
41 37
42 return ( 38 return (
diff --git a/packages/ui/src/infobox/index.tsx b/packages/ui/src/infobox/index.tsx
index 9066a623e..5070ee7ef 100644
--- a/packages/ui/src/infobox/index.tsx
+++ b/packages/ui/src/infobox/index.tsx
@@ -1,3 +1,4 @@
1import { mdiClose } from '@mdi/js';
1import { Theme } from '@meetfranz/theme'; 2import { Theme } from '@meetfranz/theme';
2import classnames from 'classnames'; 3import classnames from 'classnames';
3import React, { Component } from 'react'; 4import React, { Component } from 'react';
@@ -192,7 +193,7 @@ class InfoboxComponent extends Component<IProps, IState> {
192 onClick={this.dismiss.bind(this)} 193 onClick={this.dismiss.bind(this)}
193 className={classes.close} 194 className={classes.close}
194 > 195 >
195 <Icon icon="mdiClose" /> 196 <Icon icon={mdiClose} />
196 </button> 197 </button>
197 )} 198 )}
198 </div> 199 </div>