aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ui/icon
diff options
context:
space:
mode:
authorLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2021-10-15 15:25:41 +0530
committerLibravatar GitHub <noreply@github.com>2021-10-15 15:25:41 +0530
commit0ad7444fb1dc2cdb82830df4ef241d75a6bfd82d (patch)
tree5a994fb8e0620aa5d2542ddd9c8561ef9861a9b5 /src/components/ui/icon
parentchore: refresh lock file to fix vulnerabilities (#2075) (diff)
downloadferdium-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')
-rw-r--r--src/components/ui/icon/index.tsx46
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 @@
1import MdiIcon from '@mdi/react';
2import classnames from 'classnames';
3import { Component } from 'react';
4import injectStyle from 'react-jss';
5
6import { Theme } from '@meetfranz/theme';
7import { IWithStyle } from '../typings/generic';
8
9interface IProps extends IWithStyle {
10 icon: string;
11 size?: number;
12 className?: string;
13}
14
15const styles = (theme: Theme) => ({
16 icon: {
17 fill: theme.colorText,
18 },
19});
20
21class 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
46export const Icon = injectStyle(styles)(IconComponent);