generated from 0ctanium/nextjs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tailwind.config.js
121 lines (112 loc) · 3.47 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
const defaultConfig = require('tailwindcss/defaultTheme');
const plugin = require('tailwindcss/plugin');
const Color = require('color');
module.exports = {
purge: ['./pages/**/*.tsx', './src/components/**/*.tsx'],
darkMode: 'class', // or 'media' or 'class'
theme: {
extend: {
fontFamily: {
sans: ["'Open Sans'", ...defaultConfig.fontFamily.sans],
display: ['brandon-grotesque'],
},
spacing: {
38: '9.5rem',
},
inset: {
'-13': '-3.25rem',
},
borderWidth: {
6: '6px',
},
animation: {
'spin-slow': 'spin 3s linear infinite',
},
},
},
variants: {
extend: {
margin: ['last'],
borderWidth: ['hover'],
borderColor: ['hover'],
flexDirection: ['even'],
},
},
plugins: [
require('tailwindcss-debug-screens'),
plugin(function ({ theme, e, addComponents }) {
const { blue } = theme('colors');
const colors = {
blue,
};
// Components
const components = [];
function createButton(key, color) {
return {
[`.${e(`btn-${key}`)}`]: {
'--tw-border-opacity': 1,
borderColor: color,
borderRadius: 9999,
borderWidth: 2,
fontFamily: theme('fontFamily.sans'),
fontWeight: 500,
fontSize: '1rem',
lineHeight: '1.5rem',
paddingTop: '0.5rem',
paddingBottom: '0.5rem',
paddingLeft: '1.25rem',
paddingRight: '1.25rem',
'--tw-text-opacity': 1,
color: color,
transitionProperty:
'background-color, border-color, color, box-shadow',
transitionTimingFunction: 'cubic-bezier(0.4, 0, 0.2, 1)',
transitionDuration: '300ms',
'&:hover': {
color: Color(color).isDark()
? theme('colors.gray.200')
: theme('colors.gray.800'),
backgroundColor: color,
},
'&:focus': {
outline: '2px solid transparent',
outlineOffset: 2,
boxShadow:
'var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)',
'--tw-ring-offset-shadow':
'var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)',
'--tw-ring-shadow':
'var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)',
'--tw-ring-color': `rgba(${Color(color).red()}, ${Color(
color
).green()}, ${Color(color).blue()}, var(--tw-ring-opacity))`,
'--tw-ring-opacity': '0.6',
},
},
};
}
function createButtonsVariants(colorVariants = {}, baseKey = null) {
Object.entries(colorVariants).forEach(([key, color]) => {
if (typeof color === 'string') {
let component;
try {
component = createButton(
baseKey ? `${baseKey}-${key}` : key,
color
);
} catch (e) {
return;
}
if (component) {
components.push(component);
}
} else if (typeof color === 'object') {
createButtonsVariants(color, key);
}
});
}
createButtonsVariants(colors);
addComponents(components);
}),
],
};