Skip to content

Commit 7731f3b

Browse files
committed
borderless List test w/ example
1 parent 533177d commit 7731f3b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

docs/Examples/List.example.purs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ docs =
2929
}
3030
]
3131

32+
, h2_ "Basic List w/ no Borders"
33+
, example
34+
$ columnSelfStretch
35+
[ list defaultList
36+
{ rows = simpleListData
37+
, borders = false
38+
}
39+
]
40+
3241
, h2_ "Compact Basic List"
3342
, example
3443
$ columnSelfStretch

src/Lumi/Components/List.purs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type ListProps =
1515
{ size :: Maybe Size
1616
, rightAligned :: Boolean
1717
, rows :: Array (Array JSX)
18+
, borders :: Boolean
1819
}
1920

2021
component :: Component ListProps
@@ -30,6 +31,7 @@ list = makeStateless component $ lumiList <<< mapProps
3031
Just size -> show size
3132
Nothing -> show Medium
3233
, "data-right-aligned": props.rightAligned
34+
, "data-borders": props.borders
3335
, children: map renderRow props.rows
3436
}
3537
where
@@ -48,13 +50,15 @@ defaultList =
4850
{ size: Just $ Medium
4951
, rightAligned: false
5052
, rows: []
53+
, borders: true
5154
}
5255

5356
compactList :: ListProps
5457
compactList =
5558
{ size: Just $ Small
5659
, rightAligned: false
5760
, rows: []
61+
, borders: true
5862
}
5963

6064
type StructuredColumnListProps row =
@@ -76,6 +80,7 @@ structuredColumnList = makeStateless structuredColumnListComponent render
7680
{ size: Just $ Large
7781
, rightAligned: props.rightAligned
7882
, rows: map renderRow props.rows
83+
, borders: true
7984
}
8085
where
8186
renderRow row =
@@ -100,9 +105,9 @@ styles = jss
100105
, display: "flex"
101106
, flexFlow: "row wrap"
102107
, justifyContent: "space-between"
103-
, borderTop: [ "1px", "solid", cssStringHSLA colors.black4 ]
104108
, minHeight: "calc(48px + 1px)"
105109
, padding: "6px 0"
110+
, borderTop: [ "1px", "solid", cssStringHSLA colors.black4 ]
106111

107112
, "& > lumi-list-row-cell":
108113
{ boxSizing: "border-box"
@@ -114,6 +119,13 @@ styles = jss
114119
}
115120
}
116121

122+
, "&[data-borders=\"false\"]":
123+
{ border: "0"
124+
, "& > lumi-list-row":
125+
{ border: "0"
126+
}
127+
}
128+
117129
, "&[data-size=\"small\"] > lumi-list-row":
118130
{ minHeight: "calc(40px + 1px)"
119131
, padding: "2px 0"

0 commit comments

Comments
 (0)