@@ -2,23 +2,27 @@ module Lumi.Components.Border where
2
2
3
3
import Prelude
4
4
5
- import Color (cssStringHSLA )
5
+ import Color (toHexString )
6
6
import Lumi.Components.Color (colors )
7
7
import JSS (JSS , jss )
8
8
import React.Basic (Component , JSX , createComponent , element , makeStateless )
9
9
import React.Basic.DOM (unsafeCreateDOMComponent )
10
10
11
11
data BorderStyle
12
- = Top
13
- | Bottom
12
+ = SquareTop
13
+ | SquareBottom
14
14
| Round
15
15
| Square
16
+ | Top
17
+ | Bottom
16
18
17
19
toStyle :: BorderStyle -> String
18
- toStyle Top = " top"
19
- toStyle Bottom = " bottom"
20
+ toStyle SquareTop = " square- top"
21
+ toStyle SquareBottom = " square- bottom"
20
22
toStyle Round = " round"
21
23
toStyle Square = " square"
24
+ toStyle Top = " top"
25
+ toStyle Bottom = " bottom"
22
26
23
27
component :: Component BorderProps
24
28
component = createComponent " Border"
@@ -53,6 +57,20 @@ borderRound children =
53
57
, borderStyle: Round
54
58
}
55
59
60
+ borderSquareTop :: JSX -> JSX
61
+ borderSquareTop children =
62
+ border
63
+ { children
64
+ , borderStyle: SquareTop
65
+ }
66
+
67
+ borderSquareBottom :: JSX -> JSX
68
+ borderSquareBottom children =
69
+ border
70
+ { children
71
+ , borderStyle: SquareBottom
72
+ }
73
+
56
74
borderTop :: JSX -> JSX
57
75
borderTop children =
58
76
border
@@ -72,24 +90,41 @@ styles :: JSS
72
90
styles = jss
73
91
{ " @global" :
74
92
{ " lumi-border" :
75
- { border: " 1px solid " <> cssStringHSLA colors.black3
93
+ { borderColor: toHexString colors.black3
94
+ , borderStyle: " solid"
95
+ , borderWidth: " 1px"
96
+ , padding: " 16px"
76
97
, overflow: " hidden"
77
98
, " &[data-border-style='round']" :
78
- { borderRadius: " 5px" }
99
+ { borderRadius: " 5px"
100
+ }
79
101
, " &[data-border-style='square']" :
80
- { borderRadius: " 0px" }
81
- , " &[data-border-style='top']" :
102
+ { borderRadius: " 0px"
103
+ }
104
+ , " &[data-border-style='square-bottom']" :
82
105
{ borderTopRightRadius: " 5px"
83
106
, borderTopLeftRadius: " 5px"
84
107
, borderBottomRightRadius: " 0px"
85
108
, borderBottomLeftRadius: " 0px"
86
109
}
87
- , " &[data-border-style='bottom ']" :
110
+ , " &[data-border-style='square-top ']" :
88
111
{ borderTopRightRadius: " 0px"
89
112
, borderTopLeftRadius: " 0px"
90
113
, borderBottomRightRadius: " 5px"
91
114
, borderBottomLeftRadius: " 5px"
92
115
}
116
+ , " &[data-border-style='top']" :
117
+ { border: " inherit"
118
+ , borderTop: " 1px solid " <> toHexString colors.black3
119
+ , paddingLeft: " 0px"
120
+ , paddingRight: " 0px"
121
+ }
122
+ , " &[data-border-style='bottom']" :
123
+ { border: " inherit"
124
+ , borderBottom: " 1px solid " <> toHexString colors.black3
125
+ , paddingLeft: " 0px"
126
+ , paddingRight: " 0px"
127
+ }
93
128
}
94
129
}
95
130
}
0 commit comments