summaryrefslogtreecommitdiffstats
path: root/packages/ui/src/badge/index.tsx
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 /packages/ui/src/badge/index.tsx
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 'packages/ui/src/badge/index.tsx')
-rw-r--r--packages/ui/src/badge/index.tsx71
1 files changed, 0 insertions, 71 deletions
diff --git a/packages/ui/src/badge/index.tsx b/packages/ui/src/badge/index.tsx
deleted file mode 100644
index a8f3ebcbf..000000000
--- a/packages/ui/src/badge/index.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
1import classnames from 'classnames';
2import { Component, ReactNode } from 'react';
3import injectStyle from 'react-jss';
4
5import { Theme } from '../../../theme';
6import { IWithStyle } from '../typings/generic';
7
8interface IProps extends IWithStyle {
9 type: string;
10 className?: string;
11 children: ReactNode;
12}
13
14const badgeStyles = (theme: Theme) => {
15 const styles = {};
16 Object.keys(theme.styleTypes).map(style => {
17 Object.assign(styles, {
18 [style]: {
19 background: theme.styleTypes[style].accent,
20 color: theme.styleTypes[style].contrast,
21 border: theme.styleTypes[style].border,
22 },
23 });
24 });
25
26 return styles;
27};
28
29const styles = (theme: Theme) => ({
30 badge: {
31 display: 'inline-block',
32 padding: [3, 8, 4],
33 fontSize: theme.badgeFontSize,
34 borderRadius: theme.badgeBorderRadius,
35 margin: [0, 4],
36
37 '&:first-child': {
38 marginLeft: 0,
39 },
40
41 '&:last-child': {
42 marginRight: 0,
43 },
44 },
45 ...badgeStyles(theme),
46});
47
48class BadgeComponent extends Component<IProps> {
49 public static defaultProps = {
50 type: 'primary',
51 };
52
53 render() {
54 const { classes, children, type, className } = this.props;
55
56 return (
57 <div
58 className={classnames({
59 [classes.badge]: true,
60 [classes[type]]: true,
61 [`${className}`]: className,
62 })}
63 data-type="franz-badge"
64 >
65 {children}
66 </div>
67 );
68 }
69}
70
71export const Badge = injectStyle(styles)(BadgeComponent);