@@ -11,18 +11,22 @@ 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 CommonListProps rest =
15
15
{ size :: Maybe Size
16
16
, rightAligned :: Boolean
17
17
, rows :: Array (Array JSX )
18
- , borders :: Boolean
18
+ | rest
19
19
}
20
20
21
+ type ListProps = CommonListProps
22
+ ( borders :: Boolean
23
+ )
24
+
21
25
component :: Component ListProps
22
26
component = createComponent " List"
23
27
24
- list :: ListProps -> JSX
25
- list = makeStateless component $ lumiList <<< mapProps
28
+ listComponent :: ListProps -> JSX
29
+ listComponent = makeStateless component $ lumiList <<< mapProps
26
30
where
27
31
mapProps props =
28
32
{ className: " lumi"
@@ -45,20 +49,35 @@ list = makeStateless component $ lumiList <<< mapProps
45
49
lumiListRow = element (R .unsafeCreateDOMComponent " lumi-list-row" )
46
50
lumiListRowCell = element (R .unsafeCreateDOMComponent " lumi-list-row-cell" )
47
51
48
- defaultList :: ListProps
52
+ list :: CommonListProps () -> JSX
53
+ list props =
54
+ listComponent
55
+ { size: props.size
56
+ , rightAligned: props.rightAligned
57
+ , rows: props.rows
58
+ , borders: true
59
+ }
60
+
61
+ defaultList :: CommonListProps ()
49
62
defaultList =
50
63
{ size: Just $ Medium
51
64
, rightAligned: false
52
65
, rows: []
53
- , borders: true
54
66
}
55
67
56
- compactList :: ListProps
68
+ compactList :: CommonListProps ()
57
69
compactList =
58
70
{ size: Just $ Small
59
71
, rightAligned: false
60
72
, rows: []
61
- , borders: true
73
+ }
74
+
75
+ borderlessList :: ListProps
76
+ borderlessList =
77
+ { size: Just $ Medium
78
+ , rightAligned: false
79
+ , rows: []
80
+ , borders: false
62
81
}
63
82
64
83
type StructuredColumnListProps row =
@@ -80,7 +99,6 @@ structuredColumnList = makeStateless structuredColumnListComponent render
80
99
{ size: Just $ Large
81
100
, rightAligned: props.rightAligned
82
101
, rows: map renderRow props.rows
83
- , borders: true
84
102
}
85
103
where
86
104
renderRow row =
0 commit comments