This repository has been archived by the owner on Aug 23, 2021. It is now read-only.
forked from javifm86/tailwindcss-prefers-dark-mode
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
57 lines (49 loc) · 2.14 KB
/
index.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
55
56
57
module.exports = (prefix = 'dark', activatorClass = 'dark-mode') => {
return ({ addVariant, e }) => {
addVariant(prefix, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${activatorClass} .${e(`${prefix}${separator}${className}`)}`;
});
});
addVariant(`${prefix}:hover`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${activatorClass} .${e(`${prefix}:hover${separator}${className}`)}:hover`;
});
});
addVariant(`${prefix}:focus`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${activatorClass} .${e(`${prefix}:focus${separator}${className}`)}:focus`;
});
});
addVariant(`${prefix}:active`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${activatorClass} .${e(`${prefix}:active${separator}${className}`)}:active`;
});
});
addVariant(`${prefix}:disabled`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${activatorClass} .${e(`${prefix}:disabled${separator}${className}`)}:disabled`;
});
});
addVariant(`${prefix}:group-hover`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${activatorClass} .group:hover .${e(`${prefix}:group-hover${separator}${className}`)}`;
});
});
addVariant(`${prefix}:focus-within`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${activatorClass} .${e(`${prefix}:focus-within${separator}${className}`)}:focus-within`;
});
});
addVariant(`${prefix}:odd`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${activatorClass} .${e(`${prefix}:odd${separator}${className}`)}:nth-child(odd)`;
});
});
addVariant(`${prefix}:even`, ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${activatorClass} .${e(`${prefix}:even${separator}${className}`)}:nth-child(even)`;
});
});
};
};