@@ -11,17 +11,15 @@ import Lumi.Components.Size (Size(..))
11
11
import React.Basic (Component , JSX , createComponent , element , makeStateless )
12
12
import React.Basic.DOM as R
13
13
14
- type ListProps =
14
+ type ListProps r =
15
15
{ size :: Maybe Size
16
16
, rightAligned :: Boolean
17
17
, rows :: Array (Array JSX )
18
+ | r
18
19
}
19
20
20
- component :: Component ListProps
21
- component = createComponent " List"
22
-
23
- list :: ListProps -> JSX
24
- list = makeStateless component $ lumiList <<< mapProps
21
+ listComponent :: ListProps (borders :: Boolean ) -> JSX
22
+ listComponent = makeStateless (createComponent " List" ) $ lumiList <<< mapProps
25
23
where
26
24
mapProps props =
27
25
{ className: " lumi"
@@ -30,6 +28,7 @@ list = makeStateless component $ lumiList <<< mapProps
30
28
Just size -> show size
31
29
Nothing -> show Medium
32
30
, " data-right-aligned" : props.rightAligned
31
+ , " data-borders" : props.borders
33
32
, children: map renderRow props.rows
34
33
}
35
34
where
@@ -43,14 +42,32 @@ list = makeStateless component $ lumiList <<< mapProps
43
42
lumiListRow = element (R .unsafeCreateDOMComponent " lumi-list-row" )
44
43
lumiListRowCell = element (R .unsafeCreateDOMComponent " lumi-list-row-cell" )
45
44
46
- defaultList :: ListProps
45
+ list :: ListProps () -> JSX
46
+ list props =
47
+ listComponent
48
+ { size: props.size
49
+ , rightAligned: props.rightAligned
50
+ , rows: props.rows
51
+ , borders: true
52
+ }
53
+
54
+ borderlessList :: ListProps () -> JSX
55
+ borderlessList props =
56
+ listComponent
57
+ { size: props.size
58
+ , rightAligned: props.rightAligned
59
+ , rows: props.rows
60
+ , borders: false
61
+ }
62
+
63
+ defaultList :: ListProps ()
47
64
defaultList =
48
65
{ size: Just $ Medium
49
66
, rightAligned: false
50
67
, rows: []
51
68
}
52
69
53
- compactList :: ListProps
70
+ compactList :: ListProps ()
54
71
compactList =
55
72
{ size: Just $ Small
56
73
, rightAligned: false
@@ -100,9 +117,9 @@ styles = jss
100
117
, display: " flex"
101
118
, flexFlow: " row wrap"
102
119
, justifyContent: " space-between"
103
- , borderTop: [ " 1px" , " solid" , cssStringHSLA colors.black4 ]
104
120
, minHeight: " calc(48px + 1px)"
105
121
, padding: " 6px 0"
122
+ , borderTop: [ " 1px" , " solid" , cssStringHSLA colors.black4 ]
106
123
107
124
, " & > lumi-list-row-cell" :
108
125
{ boxSizing: " border-box"
@@ -114,6 +131,13 @@ styles = jss
114
131
}
115
132
}
116
133
134
+ , " &[data-borders=\" false\" ]" :
135
+ { border: " 0"
136
+ , " & > lumi-list-row" :
137
+ { border: " 0"
138
+ }
139
+ }
140
+
117
141
, " &[data-size=\" small\" ] > lumi-list-row" :
118
142
{ minHeight: " calc(40px + 1px)"
119
143
, padding: " 2px 0"
0 commit comments