forked from helpwithcovid/covid-volunteers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.js
127 lines (119 loc) · 3.77 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
const plugin = require('tailwindcss/plugin')
module.exports = {
theme: {
extend: {
colors: {
smoke: 'rgba(0, 0, 0, 0.5)',
'indigo-50': '#F9F9FF',
},
maxHeight: {
'400px': '400px',
},
},
container: {
center: true,
},
fontFamily: {
sans: 'Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
},
},
variants: {
translate: ['responsive', 'hover', 'focus', 'group-hover'],
display: ['responsive', 'hover', 'focus', 'group-hover'],
},
plugins: [
require('@tailwindcss/ui'),
/*
* Spacing utilities
* Ex: .space-y-bottom-2 space-x-right-4
*/
plugin(function ({ addUtilities, theme }) {
const property = 'margin'
const axes = ['x', 'y']
const directions = {
x: ['right', 'left'],
y: ['top', 'bottom'],
}
let utilities = {}
axes.forEach((axis) => {
directions[axis].forEach((direction) => {
const spacing = []
Object.keys(theme('spacing')).filter((key) => {
// fetching only the absolute values (numbers, no 1/2, 3/5, etc.)
if (!key.includes('/')) {
spacing[key] = theme('spacing')[key];
}
})
Object.keys(spacing).forEach((key) => {
const value = spacing[key]
const className = `.space-${axis}-${direction}-${key}`
const childrenProperties = {}
childrenProperties[`${property}-${direction}`] = value
const properties = {
'>*': childrenProperties,
}
utilities[className] = properties
})
})
})
addUtilities(utilities, { variants: ['responsive'] })
}),
// buttons
plugin(function ({ addComponents, theme }) {
const styles = {
display: 'inline-block',
fontSize: theme('fontSize.sm'),
padding: `${theme('spacing.2')} ${theme('spacing.4')}`,
fill: 'currentColor',
whiteSpace: 'nowrap',
backgroundColor: theme('colors.white'),
color: theme('colors.gray.900'),
border: `1px solid ${theme('colors.gray.100')}`,
transitionProperty: theme('transitionProperty.default'),
transitionDuration: theme('transitionDuration.100'),
borderRadius: theme('borderRadius.default'),
boxShadow: theme('boxShadow.default'),
'&:hover': {
backgroundColor: theme('colors.gray.100'),
},
'&:active': {
backgroundColor: theme('colors.gray.200'),
},
}
const buttons = {
'@variants responsive': {
'.button': {
...styles,
'&.button-lg': {
padding: `${theme('spacing.3')} ${theme('spacing.6')}`,
fontSize: theme('fontSize.lg'),
},
'&.button-sm': {
padding: `${theme('spacing.1')} ${theme('spacing.2')}`,
fontSize: theme('fontSize.sm'),
},
'&.button-xl': {
padding: `${theme('spacing.4')} ${theme('spacing.10')}`,
fontSize: theme('fontSize.2xl'),
},
},
'.button-indigo': {
...styles,
color: theme('colors.white'),
backgroundColor: theme('colors.indigo.600'),
'&:hover': {
backgroundColor: theme('colors.indigo.700'),
},
'&:active': {
backgroundColor: theme('colors.indigo.800'),
},
'&1active': {
backgroundColor: theme('colors.indigo.800'),
},
}
},
}
addComponents(buttons)
})
],
}