-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtailwind.config.js
54 lines (49 loc) · 1.49 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
// eslint-disable-next-line @typescript-eslint/no-var-requires
let plugin = require('tailwindcss/plugin');
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{js,ts,jsx,tsx}'],
theme: {
extend: {},
},
plugins: [
require('daisyui'),
plugin(function (helpers) {
// variants that help styling Radix-UI components
dataStateVariant('open', helpers);
dataStateVariant('closed', helpers);
dataStateVariant('on', helpers);
dataStateVariant('checked', helpers);
dataStateVariant('unchecked', helpers);
}),
],
};
function dataStateVariant(
state,
{
addVariant, // for registering custom variants
e, // for manually escaping strings meant to use in class names
}
) {
addVariant(`data-state-${state}`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${e(
`data-state-${state}${separator}${className}`
)}[data-state='${state}']`;
});
});
addVariant(`group-data-state-${state}`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.group[data-state='${state}'] .${e(
`group-data-state-${state}${separator}${className}`
)}`;
});
});
addVariant(`peer-data-state-${state}`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.peer[data-state='${state}'] ~ .${e(
`peer-data-state-${state}${separator}${className}`
)}`;
});
});
}