forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathborderRadius.js
More file actions
43 lines (40 loc) · 1.5 KB
/
borderRadius.js
File metadata and controls
43 lines (40 loc) · 1.5 KB
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
import _ from 'lodash'
export default function() {
return function({ addUtilities, e, theme, variants }) {
const generators = [
(value, modifier) => ({
[`.${e(`rounded${modifier}`)}`]: { borderRadius: `${value}` },
}),
(value, modifier) => ({
[`.${e(`rounded-t${modifier}`)}`]: {
borderTopLeftRadius: `${value}`,
borderTopRightRadius: `${value}`,
},
[`.${e(`rounded-r${modifier}`)}`]: {
borderTopRightRadius: `${value}`,
borderBottomRightRadius: `${value}`,
},
[`.${e(`rounded-b${modifier}`)}`]: {
borderBottomRightRadius: `${value}`,
borderBottomLeftRadius: `${value}`,
},
[`.${e(`rounded-l${modifier}`)}`]: {
borderTopLeftRadius: `${value}`,
borderBottomLeftRadius: `${value}`,
},
}),
(value, modifier) => ({
[`.${e(`rounded-tl${modifier}`)}`]: { borderTopLeftRadius: `${value}` },
[`.${e(`rounded-tr${modifier}`)}`]: { borderTopRightRadius: `${value}` },
[`.${e(`rounded-br${modifier}`)}`]: { borderBottomRightRadius: `${value}` },
[`.${e(`rounded-bl${modifier}`)}`]: { borderBottomLeftRadius: `${value}` },
}),
]
const utilities = _.flatMap(generators, generator => {
return _.flatMap(theme('borderRadius'), (value, modifier) => {
return generator(value, modifier === 'default' ? '' : `-${modifier}`)
})
})
addUtilities(utilities, variants('borderRadius'))
}
}