-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.ts
78 lines (76 loc) · 2.13 KB
/
tailwind.config.ts
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
import type { Config } from 'tailwindcss'
import colors from 'tailwindcss/colors'
import plugin from 'tailwindcss/plugin'
type Theme = (color: string) => string
export default {
content: [
'./app/**/*.{ts,tsx}',
'./data/**/*.{ts,tsx}',
'./components/**/*.{ts,tsx}',
'./layouts/**/*.{ts,tsx}',
'./content/**/*.mdx',
],
theme: {
extend: {
lineHeight: {
11: '2.75rem',
12: '3rem',
13: '3.25rem',
14: '3.5rem',
},
colors: {
primary: colors.pink,
gray: colors.gray,
},
fontFamily: {
mono: 'var(--font-jetbrains-mono)',
},
typography: ({ theme }: { theme: Theme }) => ({
DEFAULT: {
css: {
a: {
color: theme('colors.primary.500'),
'&:hover': {
color: theme('colors.primary.600'),
},
},
'h1,h2': {
fontWeight: '700',
},
h3: {
fontWeight: '600',
},
'h1,h2,h3,h4,h5,h6': {
letterSpacing: theme('letterSpacing.tight'),
},
'--tw-prose-pre-bg': theme('colors.slate.100 / 75%'),
},
},
}),
},
},
plugins: [
require('@tailwindcss/typography'),
// custom plugin to avoid hardcoding the values associated with 2xl and 4xl
plugin(function ({ addUtilities, theme }) {
const sizes = ['2xl', '4xl'] // Specific sizes to handle
const maxWidths = theme('maxWidth')!
const paddings = theme('padding')!
const padding2 = paddings['2']!
const tocStyles: Record<string, Record<string, string>> = {}
sizes.forEach((size) => {
const sizeValue = maxWidths[size]
/*
* The width is 50% of viewport width - (the size of the article content / 2)
*/
if (sizeValue) {
tocStyles[`.w-toc-${size}`] = {
width: `calc(50vw - (${sizeValue} / 2))`,
transform: `translateX(calc(100% + ${padding2})) translateY(1rem)`,
}
}
})
addUtilities(tocStyles)
}),
],
} satisfies Config