diff options
author | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2021-10-15 15:25:41 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-15 15:25:41 +0530 |
commit | 0ad7444fb1dc2cdb82830df4ef241d75a6bfd82d (patch) | |
tree | 5a994fb8e0620aa5d2542ddd9c8561ef9861a9b5 /packages/ui/src/headline/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 'packages/ui/src/headline/index.tsx')
-rw-r--r-- | packages/ui/src/headline/index.tsx | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/packages/ui/src/headline/index.tsx b/packages/ui/src/headline/index.tsx deleted file mode 100644 index b534a6298..000000000 --- a/packages/ui/src/headline/index.tsx +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | import classnames from 'classnames'; | ||
2 | import { Component, createElement, ReactNode } from 'react'; | ||
3 | import injectStyle from 'react-jss'; | ||
4 | |||
5 | import { Theme } from '../../../theme'; | ||
6 | import { IWithStyle, Omit } from '../typings/generic'; | ||
7 | |||
8 | interface IProps extends IWithStyle { | ||
9 | level?: number; | ||
10 | className?: string; | ||
11 | children: string | ReactNode; | ||
12 | id?: string; | ||
13 | } | ||
14 | |||
15 | const styles = (theme: Theme) => ({ | ||
16 | headline: { | ||
17 | fontWeight: 'lighter', | ||
18 | color: theme.colorText, | ||
19 | marginTop: 0, | ||
20 | marginBottom: 10, | ||
21 | textAlign: 'left', | ||
22 | }, | ||
23 | h1: { | ||
24 | fontSize: 30, | ||
25 | marginTop: 0, | ||
26 | }, | ||
27 | h2: { | ||
28 | fontSize: 20, | ||
29 | }, | ||
30 | h3: { | ||
31 | fontSize: 18, | ||
32 | }, | ||
33 | h4: { | ||
34 | fontSize: theme.uiFontSize, | ||
35 | }, | ||
36 | }); | ||
37 | |||
38 | class HeadlineComponent extends Component<IProps> { | ||
39 | render() { | ||
40 | const { classes, level, className, children, id } = this.props; | ||
41 | |||
42 | return createElement( | ||
43 | `h${level}`, | ||
44 | { | ||
45 | id, | ||
46 | className: classnames({ | ||
47 | [classes.headline]: true, | ||
48 | [classes[level ? `h${level}` : 'h1']]: true, | ||
49 | [`${className}`]: className, | ||
50 | }), | ||
51 | 'data-type': 'franz-headline', | ||
52 | }, | ||
53 | children, | ||
54 | ); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | const Headline = injectStyle(styles)(HeadlineComponent); | ||
59 | |||
60 | const createH = (level: number) => (props: Omit<IProps, 'classes' | 'theme'>) => | ||
61 | ( | ||
62 | <Headline level={level} {...props}> | ||
63 | {props.children} | ||
64 | </Headline> | ||
65 | ); | ||
66 | |||
67 | export const H1 = createH(1); | ||
68 | export const H2 = createH(2); | ||
69 | export const H3 = createH(3); | ||
70 | export const H4 = createH(4); | ||