diff options
author | 2021-10-15 15:25:41 +0530 | |
---|---|---|
committer | 2021-10-15 15:25:41 +0530 | |
commit | 0ad7444fb1dc2cdb82830df4ef241d75a6bfd82d (patch) | |
tree | 5a994fb8e0620aa5d2542ddd9c8561ef9861a9b5 /src/components/ui/icon/index.tsx | |
parent | chore: refresh lock file to fix vulnerabilities (#2075) (diff) | |
download | ferdium-app-0ad7444fb1dc2cdb82830df4ef241d75a6bfd82d.tar.gz ferdium-app-0ad7444fb1dc2cdb82830df4ef241d75a6bfd82d.tar.zst ferdium-app-0ad7444fb1dc2cdb82830df4ef241d75a6bfd82d.zip |
chore: move 'packages/ui' into 'src' (no longer an injected package) (#2077)
Diffstat (limited to 'src/components/ui/icon/index.tsx')
-rw-r--r-- | src/components/ui/icon/index.tsx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/components/ui/icon/index.tsx b/src/components/ui/icon/index.tsx new file mode 100644 index 000000000..fdc48d14a --- /dev/null +++ b/src/components/ui/icon/index.tsx | |||
@@ -0,0 +1,46 @@ | |||
1 | import MdiIcon from '@mdi/react'; | ||
2 | import classnames from 'classnames'; | ||
3 | import { Component } from 'react'; | ||
4 | import injectStyle from 'react-jss'; | ||
5 | |||
6 | import { Theme } from '@meetfranz/theme'; | ||
7 | import { IWithStyle } from '../typings/generic'; | ||
8 | |||
9 | interface IProps extends IWithStyle { | ||
10 | icon: string; | ||
11 | size?: number; | ||
12 | className?: string; | ||
13 | } | ||
14 | |||
15 | const styles = (theme: Theme) => ({ | ||
16 | icon: { | ||
17 | fill: theme.colorText, | ||
18 | }, | ||
19 | }); | ||
20 | |||
21 | class IconComponent extends Component<IProps> { | ||
22 | public static defaultProps = { | ||
23 | size: 1, | ||
24 | }; | ||
25 | |||
26 | render() { | ||
27 | const { classes, icon, size, className } = this.props; | ||
28 | |||
29 | if (!icon) { | ||
30 | console.warn('No Icon specified'); | ||
31 | } | ||
32 | |||
33 | return ( | ||
34 | <MdiIcon | ||
35 | path={icon} | ||
36 | size={size} | ||
37 | className={classnames({ | ||
38 | [classes.icon]: true, | ||
39 | [`${className}`]: className, | ||
40 | })} | ||
41 | /> | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | export const Icon = injectStyle(styles)(IconComponent); | ||