forked from acdh-oeaw/howto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.js
166 lines (162 loc) · 4.59 KB
/
tailwind.config.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
/* @ts-expect-error Missing module declaration. */
const colors = require('tailwindcss/colors')
const config = {
mode: 'jit',
purge: ['src/**/*.@(ts|tsx)'],
darkMode: false,
theme: {
extend: {
colors: {
error: colors.red,
neutral: colors.coolGray,
primary: colors.blue,
'acdh-ch-primary': '#88dbdf',
'acdh-ch-primary-text': '#58bcc1',
'acdh-ch-secondary': '#3b89a0',
'acdh-ch-muted': '#58595b',
'acdh-ch-background': '#f1f1f1',
oeaw: '#0047bb',
'brand-turquoise': 'hsl(171deg 100% 40%)',
'brand-light-blue': 'hsl(197deg 100% 76.7%)',
'brand-blue': 'hsl(202deg 69.4% 53.9%)',
'brand-black': 'hsl(202deg 0% 10%)',
'brand-light-gray': 'hsl(0deg 0% 83.1%)',
'brand-gray': 'hsl(0deg 0% 59.6%)',
},
fontFamily: {
sans: ['Inter var', 'system-ui', 'sans-serif'],
},
gridTemplateColumns: {
'content-columns': '1fr 720px 1fr',
cards: 'repeat(auto-fill, minmax(320px, 1fr))',
},
gridTemplateRows: {
'page-layout': 'auto 1fr auto',
},
maxWidth: {
/** Character units `ch` change with font size, we just want a fixed width container. */
'80ch': '720px',
},
padding: {
'10vmin': '10vmin',
},
ringOffsetWidth: {
DEFAULT: '2px',
},
typography(/** @type {(key: string) => string} */ theme) {
return {
DEFAULT: {
css: {
/** Don't add quotes around `blockquote`. */
'blockquote p:first-of-type::before': null,
'blockquote p:last-of-type::after': null,
/** Don't add backticks around inline `code`. */
'code::before': null,
'code::after': null,
'overflow-wrap': 'break-word',
a: {
'&:focus': {
outline: 'none',
},
'&:focus-visible': {
borderRadius: theme('borderRadius.DEFAULT'),
color: theme('colors.primary.600'),
boxShadow: `white 0px 0px 0px 2px, ${theme(
'colors.primary.600',
)} 0px 0px 0px 5px`,
},
},
h5: {
color: theme('colors.gray.900'),
fontWeight: '500',
fontStyle: 'italic',
marginTop: em(24, 16),
marginBottom: em(8, 16),
lineHeight: round(24 / 16),
},
'h5 strong': {
fontWeight: '700',
},
'h5 + *': {
marginTop: '0',
},
strong: {
color: 'inherit',
},
'.quiz-card p': {
margin: 0,
},
'.quiz-multiple-choice li': {
margin: 0,
padding: 0,
},
'.quiz-multiple-choice li::before': {
display: 'none',
},
'li.tab-button': {
margin: 0,
padding: 0,
},
'li.tab-button::before': {
display: 'none',
},
'.tabpanel a': {
color: 'inherit',
},
'td > strong': {
display: 'block',
'margin-block': '1.25rem',
},
'aside a': {
color: 'currentColor',
},
},
},
sm: {
css: {
h5: {
marginTop: em(20, 14),
marginBottom: em(8, 14),
lineHeight: round(20 / 14),
},
},
},
}
},
},
screens: {
'2xs': '360px',
xs: '480px',
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
'2xl': '1440px',
},
},
variants: {
extend: {
backgroundColor: ['focus-visible'],
ringColor: ['focus-visible'],
ringWidth: ['focus-visible'],
},
},
plugins: [
/* @ts-expect-error Missing module declaration. */
require('@tailwindcss/typography'),
/** @ts-expect-error Missing module declaration. */
require('@tailwindcss/aspect-ratio'),
],
}
/** @type {(num: number) => string} */
function round(num) {
return num
.toFixed(7)
.replace(/(\.[0-9]+?)0+$/, '$1')
.replace(/\.0$/, '')
}
/** @type {(px: number, base: number) => string} */
function em(px, base) {
return `${round(px / base)}em`
}
module.exports = config