generated from timelessco/react-components-template
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpreset.js
102 lines (98 loc) · 2.52 KB
/
preset.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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
const deepMerge = require("deepmerge");
const colors = require("tailwindcss/colors");
const defaultTheme = require("tailwindcss/defaultTheme");
/** @type {import("@types/tailwindcss/tailwind-config").TailwindConfig } */
const renderlesskitConfig = {
theme: {
extend: {
colors: {
orange: colors.orange,
gray: colors.gray,
emarald: colors.emerald,
violet: colors.violet,
},
fontFamily: {
sans: ["Inter var", ...defaultTheme.fontFamily.sans],
},
fontSize: {
xs: ["12px", "115%"],
cxs: ["13px", "100%"],
sm: ["14px", "115%"],
base: ["16px", "115%"],
"paragraph-cxs": ["13px", "150%"],
"2base": ["32px", "115%"],
},
inset: {
unset: "unset",
},
width: {
fit: "fit-content",
},
height: {
fit: "fit-content",
},
minWidth: {
...defaultTheme.spacing,
},
minHeight: {
...defaultTheme.spacing,
},
boxShadow: {
thumb:
"rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px",
input: "0px 0px 2px rgba(59, 130, 246, 0.6);",
},
animation: {
progress: "progress 1s ease infinite normal none running",
circularProgress:
"circularProgress 2s ease infinite normal none running",
},
keyframes: {
progress: {
"0%": { left: "-40%" },
"100%": { left: "100%" },
},
circularProgress: {
"0%": {
strokeDasharray: "1, 400",
strokeDashoffset: "0",
},
"50%": {
strokeDasharray: "400, 400",
strokeDashoffset: "-100",
},
"100%": {
strokeDasharray: "400, 400",
strokeDashoffset: "-260",
},
},
},
},
},
plugins: [
require("./tailwindPlugins/utilities"),
require("./tailwindPlugins/variantPlugin"),
],
};
function arrayMergeFn(destinationArray, sourceArray) {
return destinationArray.concat(sourceArray).reduce((acc, cur) => {
if (acc.includes(cur)) return acc;
return [...acc, cur];
}, []);
}
function preset(tailwindConfig) {
let purge;
if (Array.isArray(tailwindConfig.purge)) {
purge = {
content: tailwindConfig.purge,
};
} else {
purge = tailwindConfig.purge;
}
// @ts-ignore
return deepMerge({ ...tailwindConfig, purge }, renderlesskitConfig, {
// @ts-ignore
arrayMerge: arrayMergeFn,
});
}
module.exports = { preset };