forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelements.tsx
More file actions
72 lines (69 loc) · 1.71 KB
/
elements.tsx
File metadata and controls
72 lines (69 loc) · 1.71 KB
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
68
69
70
71
72
import styled from '../../../styled-components'
import { Colors } from 'overmind-themes'
export type Variant = keyof typeof styles
const styles = {
header: {
fontSize: 'largest',
textTransform: 'none',
fontWeight: 'bold',
padding: 'large',
densePadding: 'small',
},
title: {
fontSize: 'large',
textTransform: 'none',
fontWeight: 'bold',
padding: 'normal',
densePadding: 'smaller',
},
label: {
fontSize: 'medium',
textTransform: 'uppercase',
fontWeight: 'normal',
padding: 'small',
densePadding: 'smaller',
},
text: {
fontSize: 'normal',
textTransform: 'none',
fontWeight: 'normal',
padding: 'small',
densePadding: 'smaller',
},
description: {
fontSize: 'small',
textTransform: 'none',
fontWeight: 'normal',
padding: 'none',
densePadding: 'none',
},
hint: {
fontSize: 'smallest',
textTransform: 'none',
fontWeight: 'normal',
padding: 'none',
densePadding: 'none',
},
}
export const TextElement = styled<
{
variant?: Variant
dense?: boolean
color?: keyof Colors
mono?: boolean
},
'p'
>('p')`
font-family: ${({ mono }) => (mono ? 'monospace' : 'inherit')};
line-height: ${({ mono }) => (mono ? '16px' : 'inherit')};
margin: 0;
text-transform: ${({ theme, variant }) => styles[variant].textTransform};
padding: ${({ theme, variant, dense }) =>
dense
? `${theme.padding[styles[variant].densePadding]} 0`
: `${theme.padding[styles[variant].padding]} 0`};
color: ${({ theme, color }) => theme.color[color]};
font-size: ${({ theme, variant }) =>
theme.fontSize[styles[variant].fontSize]};
font-weight: ${({ theme, variant }) => styles[variant].fontWeight};
`