forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathborderWidths.js
More file actions
38 lines (35 loc) · 1001 Bytes
/
borderWidths.js
File metadata and controls
38 lines (35 loc) · 1001 Bytes
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
import _ from 'lodash'
import defineClasses from '../util/defineClasses'
function defineBorderWidthUtilities(borderWidths) {
const generators = [
(width, modifier) =>
defineClasses({
[`border${modifier}`]: {
'border-width': `${width}`,
},
}),
(width, modifier) =>
defineClasses({
[`border-t${modifier}`]: {
'border-top-width': `${width}`,
},
[`border-r${modifier}`]: {
'border-right-width': `${width}`,
},
[`border-b${modifier}`]: {
'border-bottom-width': `${width}`,
},
[`border-l${modifier}`]: {
'border-left-width': `${width}`,
},
}),
]
return _.flatMap(generators, generator => {
return _.flatMap(borderWidths, (width, modifier) => {
return generator(width, modifier === 'default' ? '' : `-${modifier}`)
})
})
}
module.exports = function({ borderWidths }) {
return defineBorderWidthUtilities(borderWidths)
}