1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
import React from "react";
import { switchProp, ifNotProp, ifProp } from "styled-tools";
import { Box, BoxProps } from "reflexbox/styled-components";
import styled, { css } from "styled-components";
import { FC, CSSProperties } from "react";
import { Colors } from "../consts";
interface Props extends Omit<BoxProps, "as"> {
as?: string;
htmlFor?: string;
light?: boolean;
normal?: boolean;
bold?: boolean;
style?: CSSProperties;
}
const Text: FC<Props> = styled(Box)<Props>`
font-weight: 400;
${ifNotProp(
"fontSize",
css`
font-size: ${switchProp("a", {
p: "1rem",
h1: "1.802em",
h2: "1.602em",
h3: "1.424em",
h4: "1.266em",
h5: "1.125em"
})};
`
)}
${ifProp(
"light",
css`
font-weight: 300;
`
)}
${ifProp(
"normal",
css`
font-weight: 400;
`
)}
${ifProp(
"bold",
css`
font-weight: 700;
`
)}
`;
Text.defaultProps = {
color: Colors.Text
};
export default Text;
export const H1: FC<Props> = props => <Text as="h1" {...props} />;
export const H2: FC<Props> = props => <Text as="h2" {...props} />;
export const H3: FC<Props> = props => <Text as="h3" {...props} />;
export const H4: FC<Props> = props => <Text as="h4" {...props} />;
export const H5: FC<Props> = props => <Text as="h5" {...props} />;
export const H6: FC<Props> = props => <Text as="h6" {...props} />;
export const Span: FC<Props> = props => <Text as="span" {...props} />;
|