Skip to content

Commit cad4cd1

Browse files
committed
add responsive styles
1 parent 4a2e3a8 commit cad4cd1

File tree

2 files changed

+39
-15
lines changed

2 files changed

+39
-15
lines changed

src/Lumi/Components/KeyValueList.purs

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,33 @@ keyValueList
2525
keyValueList { rightAligned, rows, borders } =
2626
let
2727
lumiKeyValueListElement = element (R.unsafeCreateDOMComponent "lumi-key-value-list")
28+
lumiKeyValueListLabelElement = element (R.unsafeCreateDOMComponent "lumi-key-value-list-label")
29+
lumiKeyValueListValueElement = element (R.unsafeCreateDOMComponent "lumi-key-value-list-value")
2830

2931
toRows r =
3032
r <#> \{ label, value } ->
3133
[ row
3234
{ style: R.css
3335
{ alignItems: "center"
36+
, justifyContent: "space-between"
37+
, width: "100%"
3438
}
3539
, children:
36-
[ T.text T.body
37-
{ style = R.css
38-
{ flex: "3 5 0%"
39-
, padding: "8px 0"
40-
}
41-
, color = notNull colorNames.black1
42-
, children = [ R.text label ]
40+
[ lumiKeyValueListLabelElement
41+
{ children:
42+
[ T.text T.body
43+
{ style = R.css {}
44+
, color = notNull colorNames.black1
45+
, children = [ R.text label ]
46+
}
47+
]
48+
, style: R.css {}
4349
}
44-
, row
45-
{ style: R.css
46-
{ alignItems: "center"
47-
, flex: "7 7 0%"
48-
, flexWrap: "wrap"
49-
, justifyContent: if rightAligned then "flex-end" else "flex-start"
50+
, lumiKeyValueListValueElement
51+
{ children: [ value ]
52+
, style: R.css
53+
{ justifyContent: if rightAligned then "flex-end" else "flex-start"
5054
}
51-
, children: [ value ]
5255
}
5356
]
5457
}
@@ -71,7 +74,26 @@ styles :: JSS
7174
styles = jss
7275
{ "@global":
7376
{ "lumi-key-value-list":
74-
{
77+
{ "& lumi-key-value-list-label":
78+
{ "flex": "3 5 0%"
79+
, "padding": "8px 0"
80+
}
81+
, "& lumi-key-value-list-value":
82+
{ "display": "flex"
83+
, "flexFlow": "row"
84+
, "alignItems": "center"
85+
, "flex": "7 7 0%"
86+
, "flexWrap": "wrap"
87+
}
88+
, "@media (max-width: 860px)":
89+
{ "width": "100%"
90+
, "& lumi-key-value-list-label":
91+
{ "flex": "initial"
92+
}
93+
, "& lumi-key-value-list-value":
94+
{ "flex": "initial"
95+
}
96+
}
7597
}
7698
}
7799
}

src/Lumi/Components/Styles.purs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import Lumi.Components.Icon as Icon
2323
import Lumi.Components.Images as Images
2424
import Lumi.Components.Input as Input
2525
import Lumi.Components.InputGroup as InputGroup
26+
import Lumi.Components.KeyValueList as KeyValueList
2627
import Lumi.Components.LabeledField as LabeledField
2728
import Lumi.Components.Layouts as Layouts
2829
import Lumi.Components.Link as Link
@@ -77,6 +78,7 @@ attachGlobalComponentStyles = do
7778
, Images.styles
7879
, Input.styles
7980
, InputGroup.styles
81+
, KeyValueList.styles
8082
, LabeledField.styles
8183
, Layouts.styles
8284
, Link.styles

0 commit comments

Comments
 (0)