-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtailwind.config.cjs
84 lines (81 loc) · 2.52 KB
/
tailwind.config.cjs
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
const plugin = require('tailwindcss/plugin');
const defaultTheme = require('tailwindcss/defaultTheme');
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
theme: {
fontFamily: {
primary: ['Gotham Rounded', ...defaultTheme.fontFamily.sans],
secondary: ['Helvetica', ...defaultTheme.fontFamily.sans],
},
extend: {
colors: {
primary: {
400: 'hsl(244, 92%, 75%)',
700: 'hsl(258, 100%, 41%)',
800: 'hsl(259, 89%, 21%)',
900: 'hsl(259, 90%, 15%)',
},
},
fontSize: {
'title-sm': ['1.3rem', { lineHeight: '1.2', letterSpacing: '-0.05em' }],
'title-md': [
'clamp(2rem, 6vw + 1rem, 4rem)',
{ lineHeight: '1', letterSpacing: '-0.05em' },
],
'title-lg': [
'clamp(2.25rem, 8vw + 1rem, 5.5rem)',
{ lineHeight: '1', letterSpacing: '-0.05em' },
],
},
keyframes: {
/** @type {Record<string, Partial<CSSStyleDeclaration>>} */
'fade-in-to-left': {
from: {
opacity: '0',
transform: 'translateX(150px)',
},
to: {
opacity: '1',
transform: 'translateX(0)',
},
},
/** @type {Record<string, Partial<CSSStyleDeclaration>>} */
'fade-in-to-right': {
from: {
opacity: '0',
transform: 'translateX(-150px)',
},
to: {
opacity: '1',
transform: 'translateX(0)',
},
},
},
},
},
plugins: [
plugin(({ addVariant }) => {
addVariant('where', ':where(&)');
addVariant('hocus', ['&:hover', '&:focus-visible']);
addVariant('group-hocus', ['.group:hover &', '.group:focus-visible &']);
}),
plugin(({ matchUtilities }) => {
matchUtilities({
'bg-srcset': (value) => {
const [imgPath, imgExtension] = value.split('.');
/** @param {number} imgWidth */
const toUrl = (imgWidth) =>
`url(${imgPath}-${imgWidth}w.${imgExtension})`;
/** @type {Partial<CSSStyleDeclaration> & Record<string, Partial<CSSStyleDeclaration>>} */
const result = {
backgroundImage: toUrl(1280),
'@media (min-width: 1281px)': { backgroundImage: toUrl(1920) },
'@media (min-width: 1921px)': { backgroundImage: toUrl(3840) },
};
return result;
},
});
}),
],
};