-
Notifications
You must be signed in to change notification settings - Fork 373
/
Copy pathtailwind.config.js
201 lines (190 loc) · 4.99 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/* eslint-disable */
const range = require("lodash/range");
const fromPairs = require("lodash/fromPairs");
const merge = require("lodash/merge");
const defaultConfig = require("tailwindcss/defaultConfig");
/**
* @See https://www.notion.so/gmxio/Colors-Clean-Up-13303574745d80deb5dcebb6f15e41ad#13303574745d8066aad0cbd650848ca6
*/
const colors = {
blue: {
300: "#7885ff",
400: "#4d5ffa",
500: "#3d51ff",
600: "#2d42fc",
700: "#2e3dcd",
},
"cold-blue": {
500: "#3a3f79",
700: "#282b54",
900: "#1e203e",
},
"pale-blue": {
100: "rgba(180,187,255, 0.1)",
600: "rgba(180,187,255, 0.6)",
},
slate: {
100: "#a0a3c4",
500: "#3e4361",
600: "#373c58",
700: "#23263b",
750: "#17182c",
800: "#16182e",
900: "#101124",
950: "#08091b",
},
gray: {
50: "rgba(255, 255, 255, 0.95)",
100: "#e7e7e9",
200: "#cfcfd3",
300: "#b7b8bd",
400: "#9fa0a7",
500: "#878891",
600: "#70707c",
700: "#585866",
800: "rgba(255, 255, 255, 0.2)",
900: "rgba(255, 255, 255, 0.1)",
950: "rgba(255, 255, 255, 0.05)",
},
yellow: {
300: "#ffe166",
500: "#f3b50c",
},
red: {
400: "#ff637a",
500: "#FF506A",
},
green: {
300: "#56dba8",
400: "#8CF3CB",
500: "#0FDE8D",
},
white: "#ffffff",
black: "#000000",
stroke: {
primary: "#252A47",
},
};
/**
* @type {import('tailwindcss/types/config').PluginCreator}
*/
function injectColorsPlugin({ addBase, theme }) {
function extractColorVars(colorObj, colorGroup = "") {
return Object.keys(colorObj).reduce((vars, colorKey) => {
const value = colorObj[colorKey];
const visualColorKey = colorKey === "DEFAULT" ? "" : `-${colorKey}`;
const newVars =
typeof value === "string"
? { [`--color${colorGroup}${visualColorKey}`]: value }
: extractColorVars(value, `-${colorKey}`);
return { ...vars, ...newVars };
}, {});
}
addBase({
":root": extractColorVars(theme("colors")),
});
}
/**
* @type {import('tailwindcss/types/config').PluginCreator}
*/
function customUtilsPlugin({ addUtilities, theme }) {
addUtilities({
".scrollbar-hide": {
"scrollbar-width": "none",
"-ms-overflow-style": "none",
"&::-webkit-scrollbar": {
display: "none",
},
},
});
}
/**
* @type {import('tailwindcss/types/config').PluginCreator}
* @See https://www.notion.so/gmxio/Fonts-Clean-Up-13303574745d8015b115e03426827f3c
*/
function fontComponentsPlugin({ addComponents, addBase }) {
addBase({
":root": {
"--font-size-h1": '3.4rem',
"--font-size-h2": '2.4rem',
"--font-size-body-large": '1.6rem',
"--font-size-body-medium": '1.4rem',
"--font-size-body-small": '1.2rem',
"--font-size-caption": '1rem',
"--line-height-h1": '34px',
"--line-height-h2": '24px',
"--line-height-body-large": '2.1rem',
"--line-height-body-medium": '1.8rem',
"--line-height-body-small": '1.6rem',
"--line-height-caption": '1.4rem',
},
});
addComponents({
".text-h1": {
fontSize: '3.4rem',
lineHeight: 'auto',
},
".text-h2": {
fontSize: '2.4rem',
lineHeight: 'auto',
},
".text-body-large": {
fontSize: '1.6rem',
lineHeight: '2.1rem',
},
".text-body-medium": {
fontSize: '1.4rem',
lineHeight: '1.8rem',
},
'.text-body-small': {
fontSize: '1.2rem',
lineHeight: '1.6rem',
},
'.text-caption': {
fontSize: '1rem',
lineHeight: '1.4rem',
},
});
}
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./index.html", "./src/**/*.{js,jsx,ts,tsx}"],
theme: {
// @see https://tailwindcss.com/docs/customizing-spacing
spacing: fromPairs(range(0, 96 + 1).map((spacing) => [spacing, `${spacing}px`])),
borderRadius: merge(fromPairs(range(0, 96 + 1).map((borderRadius) => [borderRadius, `${borderRadius}px`])), {
full: "9999px",
}),
fontSize: {
12: "1.2rem",
14: "1.4rem",
15: "1.5rem",
16: "1.6rem",
24: "2.4rem",
34: "3.4rem",
},
lineHeight: {
1: "1",
2: "2",
// Normal is browser dependent. See https://developer.mozilla.org/en-US/docs/Web/CSS/line-height#normal
base: "normal",
},
// @see https://tailwindcss.com/docs/customizing-colors
colors: colors,
textDecorationColor: colors,
placeholderColor: {
...colors,
gray: "rgb(117, 117, 117)",
},
// @see https://tailwindcss.com/blog/tailwindcss-v3-2#max-width-and-dynamic-breakpoints
// "these features will only be available if your project uses a simple screens configuration."
// So we just copy the default screens config
screens: defaultConfig.theme.screens,
extend: {
gridTemplateColumns: fromPairs(
range(200, 501, 50).map((space) => [`auto-fill-${space}`, `repeat(auto-fill, minmax(${space}px, 1fr))`])
),
},
},
plugins: [injectColorsPlugin, customUtilsPlugin, fontComponentsPlugin],
};