-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtailwind.config.ts
More file actions
63 lines (58 loc) · 2.18 KB
/
Copy pathtailwind.config.ts
File metadata and controls
63 lines (58 loc) · 2.18 KB
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
import { spacingTokenByValue } from '@codegouvfr/react-dsfr/fr/generatedFromCss/spacing';
import type { Config } from 'tailwindcss';
import animate from 'tailwindcss-animate';
// Import colors through .mjs wrapper to work around Turbopack module resolution
// See tailwind.colors.mjs for details
import colors from './tailwind.colors.mjs';
const config = {
content: ['./src/**/*.{js,ts,jsx,tsx,mdx}'],
important: true, // surcharge toujours le DSFR qui n'utilise pas les layers
plugins: [
animate,
({ addUtilities }) => {
// Make spacing from DSFR available with hover and md: https://www.systeme-de-design.gouv.fr/fondamentaux/espacement
Object.entries(spacingTokenByValue).forEach(([token, value]) => {
const utilities = {
[`.fr-p-${token}`]: { padding: value },
[`.fr-m-${token}`]: { margin: value },
[`.fr-mt-${token}`]: { marginTop: value },
[`.fr-mr-${token}`]: { marginRight: value },
[`.fr-mb-${token}`]: { marginBottom: value },
[`.fr-ml-${token}`]: { marginLeft: value },
};
addUtilities(utilities, ['responsive', 'hover']);
});
// Add flex ratio utilities from 2 to 12
const flexRatios = Object.fromEntries(
Array.from({ length: 11 }, (_, i) => i + 2).map((ratio) => [`.flex-${ratio}`, { flex: `${ratio} 0 0%` }])
);
addUtilities(flexRatios, ['responsive']);
},
],
theme: {
extend: {
animation: {
puff: 'puff 0.2s ease-in-out',
},
colors,
keyframes: {
puff: {
'0%': { opacity: '1', transform: 'scale(1)' },
'50%': { opacity: '0.8', transform: 'scale(1.1)' },
'100%': { opacity: '1', transform: 'scale(1)' },
},
},
// Use breakpoints from DSFR https://www.systeme-de-design.gouv.fr/fondamentaux/grille-et-points-de-rupture
screens: {
lg: '992px',
md: '768px',
sm: '576px',
xl: '1200px',
xs: '320px',
},
// Use spacing from DSFR through md:my-10w https://www.systeme-de-design.gouv.fr/fondamentaux/couleurs-palette
spacing: spacingTokenByValue,
},
},
} satisfies Config;
export default config;