1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | const round = num =>
|
8 | num
|
9 | .toFixed(7)
|
10 | .replace(/(\.[0-9]+?)0+$/, '$1')
|
11 | .replace(/\.0$/, '')
|
12 | const rem = px => `${round(px / 16)}rem`
|
13 |
|
14 | module.exports = {
|
15 | variants: ['responsive'],
|
16 | utility: theme => ({
|
17 | '.xt-mt-auto': {
|
18 | '&:first-child': {
|
19 | marginTop: '0',
|
20 | },
|
21 | },
|
22 | '.xt-mb-auto': {
|
23 | '&:last-child': {
|
24 | marginBottom: '0',
|
25 | },
|
26 | },
|
27 | '.xt-my-auto': {
|
28 | '&:first-child': {
|
29 | marginTop: '0',
|
30 | },
|
31 | '&:last-child': {
|
32 | marginBottom: '0',
|
33 | },
|
34 | },
|
35 | '.xt-h1': {
|
36 | marginTop: theme('spacing.10'),
|
37 | marginBottom: theme('spacing.4'),
|
38 | fontFamily: theme('fontFamily.sans').toString(),
|
39 | fontWeight: theme('fontWeight.bold'),
|
40 | fontSize: rem(38),
|
41 | lineHeight: theme('lineHeight.tight'),
|
42 | letterSpacing: theme('letterSpacing.tight'),
|
43 | textTransform: 'none',
|
44 | '&:first-child': {
|
45 | marginTop: '0',
|
46 | },
|
47 | '&:last-child': {
|
48 | marginBottom: '0',
|
49 | },
|
50 | },
|
51 | '.xt-h2': {
|
52 | marginTop: theme('spacing.10'),
|
53 | marginBottom: theme('spacing.4'),
|
54 | fontFamily: theme('fontFamily.sans').toString(),
|
55 | fontWeight: theme('fontWeight.bold'),
|
56 | fontSize: rem(34),
|
57 | lineHeight: theme('lineHeight.tight'),
|
58 | letterSpacing: theme('letterSpacing.tight'),
|
59 | textTransform: 'none',
|
60 | '&:first-child': {
|
61 | marginTop: '0',
|
62 | },
|
63 | '&:last-child': {
|
64 | marginBottom: '0',
|
65 | },
|
66 | },
|
67 | '.xt-h3': {
|
68 | marginTop: theme('spacing.10'),
|
69 | marginBottom: theme('spacing.4'),
|
70 | fontFamily: theme('fontFamily.sans').toString(),
|
71 | fontWeight: theme('fontWeight.bold'),
|
72 | fontSize: rem(30),
|
73 | lineHeight: theme('lineHeight.tight'),
|
74 | letterSpacing: theme('letterSpacing.tight'),
|
75 | textTransform: 'none',
|
76 | '&:first-child': {
|
77 | marginTop: '0',
|
78 | },
|
79 | '&:last-child': {
|
80 | marginBottom: '0',
|
81 | },
|
82 | },
|
83 | '.xt-h4': {
|
84 | marginTop: theme('spacing.5'),
|
85 | marginBottom: theme('spacing.3'),
|
86 | fontFamily: theme('fontFamily.sans').toString(),
|
87 | fontWeight: theme('fontWeight.bold'),
|
88 | fontSize: rem(26),
|
89 | lineHeight: theme('lineHeight.tight'),
|
90 | letterSpacing: theme('letterSpacing.tight'),
|
91 | textTransform: 'none',
|
92 | '&:first-child': {
|
93 | marginTop: '0',
|
94 | },
|
95 | '&:last-child': {
|
96 | marginBottom: '0',
|
97 | },
|
98 | },
|
99 | '.xt-h5': {
|
100 | marginTop: theme('spacing.5'),
|
101 | marginBottom: theme('spacing.3'),
|
102 | fontFamily: theme('fontFamily.sans').toString(),
|
103 | fontWeight: theme('fontWeight.bold'),
|
104 | fontSize: rem(22),
|
105 | lineHeight: theme('lineHeight.tight'),
|
106 | letterSpacing: theme('letterSpacing.tight'),
|
107 | textTransform: 'none',
|
108 | '&:first-child': {
|
109 | marginTop: '0',
|
110 | },
|
111 | '&:last-child': {
|
112 | marginBottom: '0',
|
113 | },
|
114 | },
|
115 | '.xt-h6': {
|
116 | marginTop: theme('spacing.5'),
|
117 | marginBottom: theme('spacing.2'),
|
118 | fontFamily: theme('fontFamily.sans').toString(),
|
119 | fontWeight: theme('fontWeight.bold'),
|
120 | fontSize: rem(18),
|
121 | lineHeight: theme('lineHeight.tight'),
|
122 | letterSpacing: theme('letterSpacing.tight'),
|
123 | textTransform: 'none',
|
124 | '&:first-child': {
|
125 | marginTop: '0',
|
126 | },
|
127 | '&:last-child': {
|
128 | marginBottom: '0',
|
129 | },
|
130 | },
|
131 | '.xt-p': {
|
132 | fontFamily: 'inherit',
|
133 | fontStyle: 'inherit',
|
134 | fontWeight: 'inherit',
|
135 | fontSize: 'inherit',
|
136 | lineHeight: 'inherit',
|
137 | letterSpacing: 'inherit',
|
138 | textTransform: 'inherit',
|
139 | marginTop: theme('spacing.0'),
|
140 | marginBottom: theme('spacing.4'),
|
141 | '&:last-child': {
|
142 | marginBottom: '0',
|
143 | },
|
144 | },
|
145 | '.xt-ul': {
|
146 | marginBottom: theme('spacing.4'),
|
147 | paddingLeft: theme('spacing.2'),
|
148 | '&:last-child': {
|
149 | marginBottom: '0',
|
150 | },
|
151 | '> li': {
|
152 | position: 'relative',
|
153 | marginBottom: theme('spacing.4'),
|
154 | paddingLeft: theme('spacing.5'),
|
155 | '&:last-child': {
|
156 | marginBottom: '0',
|
157 | },
|
158 | '&:before': {
|
159 | position: 'absolute',
|
160 | display: 'inline-block',
|
161 | left: '0',
|
162 | content: '"\\2022"',
|
163 | },
|
164 | '> ul, > ol': {
|
165 | marginTop: theme('spacing.4'),
|
166 | },
|
167 | },
|
168 | },
|
169 | '.xt-ol': {
|
170 | listStyleType: 'decimal',
|
171 | '&[type="a"]': {
|
172 | listStyleType: 'lower-alpha',
|
173 | },
|
174 | '&[type="i"]': {
|
175 | listStyleType: 'lower-roman',
|
176 | },
|
177 | marginBottom: theme('spacing.4'),
|
178 | paddingLeft: theme('spacing.5'),
|
179 | '&:last-child': {
|
180 | marginBottom: '0',
|
181 | },
|
182 | '> li': {
|
183 | position: 'relative',
|
184 | marginBottom: theme('spacing.4'),
|
185 | paddingLeft: theme('spacing.2'),
|
186 | '&:last-child': {
|
187 | marginBottom: '0',
|
188 | },
|
189 | '&:before': {
|
190 | display: 'none',
|
191 | },
|
192 | '> ul, > ol': {
|
193 | marginTop: theme('spacing.4'),
|
194 | },
|
195 | },
|
196 | },
|
197 | '.xt-dl': {
|
198 | marginBottom: theme('spacing.4'),
|
199 | '&:last-child': {
|
200 | marginBottom: '0',
|
201 | },
|
202 | },
|
203 | '.xt-blockquote': {
|
204 | marginTop: theme('spacing.4'),
|
205 | marginBottom: theme('spacing.4'),
|
206 | '&:first-child': {
|
207 | marginTop: '0',
|
208 | },
|
209 | '&:last-child': {
|
210 | marginBottom: '0',
|
211 | },
|
212 | paddingLeft: theme('spacing.7'),
|
213 | borderLeft: `4px solid ${theme('colors.gray.200')}`,
|
214 | },
|
215 | '.xt-hr': {
|
216 | marginTop: theme('spacing.4'),
|
217 | marginBottom: theme('spacing.4'),
|
218 | '&:first-child': {
|
219 | marginTop: '0',
|
220 | },
|
221 | '&:last-child': {
|
222 | marginBottom: '0',
|
223 | },
|
224 | },
|
225 | '.xt-figure': {
|
226 | marginTop: theme('spacing.8'),
|
227 | marginBottom: theme('spacing.8'),
|
228 | '&:first-child': {
|
229 | marginTop: '0',
|
230 | },
|
231 | '&:last-child': {
|
232 | marginBottom: '0',
|
233 | },
|
234 | },
|
235 | '.xt-figcaption': {
|
236 | marginTop: theme('spacing.4'),
|
237 | fontSize: rem(14),
|
238 | lineHeight: theme('lineHeight.snug'),
|
239 | },
|
240 | '.xt-text-reset': {
|
241 | fontFamily: 'inherit',
|
242 | fontStyle: 'inherit',
|
243 | fontWeight: 'inherit',
|
244 | fontSize: 'inherit',
|
245 | lineHeight: 'inherit',
|
246 | letterSpacing: 'inherit',
|
247 | textTransform: 'inherit',
|
248 | },
|
249 | '.xt-lowercase-capitalize': {
|
250 | textTransform: 'lowercase',
|
251 | '&:first-letter': {
|
252 | textTransform: 'uppercase',
|
253 | },
|
254 | },
|
255 | }),
|
256 | component: {
|
257 |
|
258 | '.xt-body:not(.xt-optout-typography)': {
|
259 | '-webkit-font-smoothing': 'antialiased',
|
260 | '-moz-osx-font-smoothing': 'grayscale',
|
261 | },
|
262 | 'h1:not([class])': {
|
263 | '@apply xt-h1': '',
|
264 | },
|
265 | 'h2:not([class])': {
|
266 | '@apply xt-h2': '',
|
267 | },
|
268 | 'h3:not([class])': {
|
269 | '@apply xt-h3': '',
|
270 | },
|
271 | 'h4:not([class])': {
|
272 | '@apply xt-h4': '',
|
273 | },
|
274 | 'h5:not([class])': {
|
275 | '@apply xt-h5': '',
|
276 | },
|
277 | 'h6:not([class])': {
|
278 | '@apply xt-h6': '',
|
279 | },
|
280 | 'p:not([class])': {
|
281 | '@apply xt-p': '',
|
282 | },
|
283 | 'ul:not([class])': {
|
284 | '@apply xt-ul': '',
|
285 | },
|
286 | 'ol:not([class])': {
|
287 | '@apply xt-ol': '',
|
288 | },
|
289 | 'dl:not([class])': {
|
290 | '@apply xt-dl': '',
|
291 | },
|
292 | 'blockquote:not([class])': {
|
293 | '@apply xt-blockquote': '',
|
294 | },
|
295 | 'hr:not([class])': {
|
296 | '@apply xt-hr': '',
|
297 | },
|
298 | 'figure:not([class])': {
|
299 | '@apply xt-figure': '',
|
300 | },
|
301 | 'figcaption:not([class])': {
|
302 | '@apply xt-figcaption': '',
|
303 | },
|
304 | },
|
305 | }
|