/
markdown-styles.js
219 lines (193 loc) Β· 4.51 KB
/
markdown-styles.js
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
// @flow
/** @jsx jsx */
import { jsx } from '@emotion/core'
import styled from '@emotion/styled'
import css from '@emotion/css'
import { mq, colors, constants, animatedUnderline } from './style'
const textStyles = mq({
fontSize: [15, 16],
marginTop: 20,
color: colors.color,
fontWeight: 400,
lineHeight: '1.7'
})
export const p = styled.p<empty>(textStyles)
export const code = styled.code<empty>(
textStyles,
mq({
backgroundColor: 'rgba(117, 63, 131, 0.07)',
borderRadius: '0.325rem',
fontSize: ['80%', '85%'],
margin: 0,
padding: '0.2rem 0.325rem'
})
)
export const pre = styled.pre<empty>({
'& > code': {
padding: 0
}
})
export const ul = styled.ul<empty>({
marginTop: 20,
paddingLeft: 20,
'& li': {
marginTop: 10
},
'& ol, & ul': {
marginLeft: 20,
marginTop: 10
}
})
export const li = styled.li<empty>(textStyles, {
marginTop: 10,
p: { marginTop: 5, marginBottom: 0 },
'& > ul, & > ol': {
marginTop: 5,
marginBottom: 15,
'& > li': {
marginTop: 5
}
}
})
// $FlowFixMe(flow@0.100.0): tagged templates don't support generics
export const img = styled.img`
max-height: 360px;
margin: 0 auto;
`
const baseHeadingStyles = css`
color: ${colors.color};
margin: 30px 0 0 0;
font-weight: 600;
line-height: 1.2;
`
// $FlowFixMe(flow@0.100.0): tagged templates don't support generics
export const h1 = styled.h1`
margin-top: 32px;
padding-top: 20px;
font-size: 32px;
${baseHeadingStyles};
`
// $FlowFixMe(flow@0.100.0): tagged templates don't support generics
export const h2 = styled.h2`
${baseHeadingStyles};
font-size: 24px;
padding-top: 15px;
padding-bottom: 8px;
border-bottom: 1px solid ${colors.lighten(0.25, colors.border)};
& + h3 {
margin-top: 0;
}
`
// $FlowFixMe(flow@0.100.0): tagged templates don't support generics
export const h3 = styled.h3`
font-size: 20px;
padding-top: 20px;
${baseHeadingStyles};
`
// $FlowFixMe(flow@0.100.0): tagged templates don't support generics
export const h4 = styled.h4`
font-size: 16px;
margin-top: 22px;
padding-top: 15px;
${baseHeadingStyles};
`
// $FlowFixMe(flow@0.100.0): tagged templates don't support generics
export const h5 = styled.h5`
font-size: 14px;
`
// $FlowFixMe(flow@0.100.0): tagged templates don't support generics
export const h6 = styled.div`
font-size: 12;
`
export const a = styled.a<empty>(
{
display: 'inline-block',
fontSize: constants.fontSizes[2],
fontWeight: '500',
color: colors.hightlight,
textDecoration: 'none',
'&:hover': {
color: colors.border,
code: {
color: colors.border
}
},
'&.anchor': {
backgroundColor: 'initial',
borderBottom: 'initial'
},
code: {
'&:hover': { color: colors.border }
}
},
animatedUnderline
)
// $FlowFixMe(flow@0.100.0): tagged templates don't support generics
export const blockquote = styled.blockquote`
display: flex;
align-items: center;
margin: 0;
margin-top: ${constants.space[3]}px;
border-left: 5px solid ${colors.border};
background-color: ${colors.parentBg};
padding: 10px;
text-align: left;
border-bottom-right-radius: 8px;
border-top-right-radius: 8px;
padding-right: 16px;
padding-left: 16px;
padding-top: 16px;
padding-bottom: 16px;
p {
margin: 0;
&:first-of-type {
font-weight: 700;
margin-top: 0;
margin-bottom: 0;
}
&:nth-of-type(2) {
margin-top: 4px;
margin-left: 8px;
padding: 0 16px;
}
}
`
// $FlowFixMe(flow@0.100.0): tagged templates don't support generics
export const table = styled.table`
display: block;
width: 100%;
overflow: auto;
word-break: normal;
word-break: keep-all;
border-collapse: collapse;
border-spacing: 0;
margin-top: 24px;
& tr:nth-child(2n) {
background-color: ${colors.parentBg};
}
& code {
font-size: 13px;
}
`
// $FlowFixMe(flow@0.100.0): tagged templates don't support generics
export const td = styled.td`
padding: 12px 12px;
border: 1px solid ${colors.color};
`
// $FlowFixMe(flow@0.100.0): tagged templates don't support generics
export const th = styled.th`
padding: ${constants.space[1]}px ${constants.space[2]}px;
border: 1px solid ${colors.color};
font-weight: bold;
`
// $FlowFixMe(flow@0.100.0): tagged templates don't support generics
export const tr = styled.tr`
background-color: #fff;
border-top: 1px solid #ccc;
`
export let hr = (props: {}) => (
<hr
css={{ border: `1px solid ${colors.lighten(0.25, colors.border)}` }}
{...props}
/>
)