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/badge/ProBadge.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/badge/ProBadge.tsx')
-rw-r--r-- | src/components/ui/badge/ProBadge.tsx | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/components/ui/badge/ProBadge.tsx b/src/components/ui/badge/ProBadge.tsx new file mode 100644 index 000000000..cb6bc4c98 --- /dev/null +++ b/src/components/ui/badge/ProBadge.tsx | |||
@@ -0,0 +1,64 @@ | |||
1 | import { mdiStar } from '@mdi/js'; | ||
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 { Icon } from '../icon'; | ||
8 | import { Badge } from './index'; | ||
9 | import { IWithStyle } from '../typings/generic'; | ||
10 | |||
11 | interface IProps extends IWithStyle { | ||
12 | badgeClasses?: string; | ||
13 | iconClasses?: string; | ||
14 | inverted?: boolean; | ||
15 | className?: string; | ||
16 | } | ||
17 | |||
18 | const styles = (theme: Theme) => ({ | ||
19 | badge: { | ||
20 | height: 'auto', | ||
21 | padding: [4, 6, 2, 7], | ||
22 | borderRadius: theme.borderRadiusSmall, | ||
23 | }, | ||
24 | invertedBadge: { | ||
25 | background: theme.styleTypes.primary.contrast, | ||
26 | color: theme.styleTypes.primary.accent, | ||
27 | }, | ||
28 | icon: { | ||
29 | fill: theme.styleTypes.primary.contrast, | ||
30 | }, | ||
31 | invertedIcon: { | ||
32 | fill: theme.styleTypes.primary.accent, | ||
33 | }, | ||
34 | }); | ||
35 | |||
36 | class ProBadgeComponent extends Component<IProps> { | ||
37 | render() { | ||
38 | const { classes, badgeClasses, iconClasses, inverted, className } = | ||
39 | this.props; | ||
40 | |||
41 | return ( | ||
42 | <Badge | ||
43 | type="primary" | ||
44 | className={classnames([ | ||
45 | classes.badge, | ||
46 | inverted && classes.invertedBadge, | ||
47 | badgeClasses, | ||
48 | className, | ||
49 | ])} | ||
50 | > | ||
51 | <Icon | ||
52 | icon={mdiStar} | ||
53 | className={classnames([ | ||
54 | classes.icon, | ||
55 | inverted && classes.invertedIcon, | ||
56 | iconClasses, | ||
57 | ])} | ||
58 | /> | ||
59 | </Badge> | ||
60 | ); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | export const ProBadge = injectStyle(styles)(ProBadgeComponent); | ||