-
-
Notifications
You must be signed in to change notification settings - Fork 106
/
borders.js
106 lines (87 loc) Β· 1.87 KB
/
borders.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
import { num } from '@xstyled/util'
import { style, themeGetter, compose } from '../style'
import { px } from '../unit'
import { getColor, getRadius, getPx } from './basics'
// Getters
export const getBorder = themeGetter({
name: 'border',
key: 'borders',
transform: n => (num(n) && n > 0 ? `${px(n)} solid` : n),
})
export const getBorderWidth = themeGetter({
name: 'borderWidth',
key: 'borderWidths',
compose: getPx,
})
export const getBorderStyle = themeGetter({
name: 'borderStyle',
key: 'borderStyles',
})
// Style
export const border = style({
prop: 'border',
themeGet: getBorder,
})
export const borderTop = style({
prop: 'borderTop',
themeGet: getBorder,
})
export const borderTopColor = style({
prop: 'borderTopColor',
themeGet: getColor,
})
export const borderRight = style({
prop: 'borderRight',
themeGet: getBorder,
})
export const borderRightColor = style({
prop: 'borderRightColor',
themeGet: getColor,
})
export const borderBottom = style({
prop: 'borderBottom',
themeGet: getBorder,
})
export const borderBottomColor = style({
prop: 'borderBottomColor',
themeGet: getColor,
})
export const borderLeft = style({
prop: 'borderLeft',
themeGet: getBorder,
})
export const borderLeftColor = style({
prop: 'borderLeftColor',
themeGet: getColor,
})
export const borderColor = style({
prop: 'borderColor',
themeGet: getColor,
})
export const borderWidth = style({
prop: 'borderWidth',
themeGet: getBorderWidth,
})
export const borderStyle = style({
prop: 'borderStyle',
themeGet: getBorderStyle,
})
export const borderRadius = style({
prop: 'borderRadius',
themeGet: getRadius,
})
export const borders = compose(
border,
borderTop,
borderTopColor,
borderRight,
borderRightColor,
borderBottom,
borderBottomColor,
borderLeft,
borderLeftColor,
borderColor,
borderWidth,
borderStyle,
borderRadius,
)