-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtailwind.config.mjs
79 lines (77 loc) · 2.4 KB
/
tailwind.config.mjs
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
import plugin from 'tailwindcss/plugin'
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
theme: {
boxShadow: {
DEFAULT: 'var(--box-shadow)',
hover: 'var(--box-shadow-hover)'
},
boxShadowColor: {
DEFAULT: 'var(--box-shadow-color)'
},
colors: {
gray: {
50: 'var(--color-gray-50)',
100: 'var(--color-gray-100)',
800: 'var(--color-gray-800)'
},
anchor: 'var(--color-anchor)',
heading: 'var(--color-heading)',
header: {
logo: 'var(--color-header-logo)'
},
hero: {
'visual-line': 'var(--color-hero-visual-line)'
},
activities: {
icon: 'var(--color-activities-icon)'
},
card: {
bg: 'var(--color-card-bg)'
},
footer: {
bg: 'var(--color-footer-bg)',
text: 'var(--color-footer-text)'
}
}
},
plugins: [
/**
* Safe area utilities
* | Utilities | Styles |
* | ----------------- | ------------------------------------------------- |
* | mx-safe, px-safe | env(safe-area-inset-{right, left}) |
* | my-safe, py-safe | env(safe-area-inset-{top, bottom}) |
* | mt-safe, pt-safe | env(safe-area-inset-top) |
* | mr-safe, pr-safe | env(safe-area-inset-right) |
* | mb-safe, pb-safe | env(safe-area-inset-bottom) |
* | ml-safe, pl-safe | env(safe-area-inset-left) |
*/
plugin(({ addUtilities }) => {
/**
* @param spacingProperty {'padding' | 'margin'}
*/
const generate = (spacingProperty) =>
Object.entries({
x: ['left', 'right'],
y: ['top', 'bottom'],
t: ['top'],
r: ['right'],
b: ['bottom'],
l: ['left']
}).map(([key, directions]) => ({
[`.${spacingProperty === 'padding' ? 'p' : 'm'}${key}-safe`]:
directions.reduce(
(prev, direction) => ({
...prev,
[`${spacingProperty}-${direction}`]: `env(safe-area-inset-${direction})`
}),
{}
)
}))
addUtilities(generate('padding'))
addUtilities(generate('margin'))
})
]
}