Skip to content

Commit da5a0d9

Browse files
author
Madeline Trotter
committed
Fix secondary button loading state
1 parent dd2f810 commit da5a0d9

File tree

4 files changed

+40
-20
lines changed

4 files changed

+40
-20
lines changed

docs/Examples2/Button.example.purs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,27 +158,50 @@ docs =
158158
$ button
159159
$ submit Loading
160160
$$$ [ R.text "Save" ]
161+
, example
162+
$ button
163+
$ secondary
164+
$ submit Loading
165+
$$$ [ R.text "Save" ]
161166
]
162167
, [ h4_ "Loading (Small) "
163168
, example
164169
$ button
165170
$ resize Small
166171
$ submit Loading
167172
$$$ [ R.text "Save" ]
173+
, example
174+
$ button
175+
$ secondary
176+
$ resize Small
177+
$ submit Loading
178+
$$$ [ R.text "Save" ]
168179
]
169180
, [ h4_ "Loading (Large) "
170181
, example
171182
$ button
172183
$ resize Large
173184
$ submit Loading
174185
$$$ [ R.text "Save" ]
186+
, example
187+
$ button
188+
$ secondary
189+
$ resize Large
190+
$ submit Loading
191+
$$$ [ R.text "Save" ]
175192
]
176193
, [ h4_ "Loading (ExtraLarge) "
177194
, example
178195
$ button
179196
$ resize ExtraLarge
180197
$ submit Loading
181198
$$$ [ R.text "Save" ]
199+
, example
200+
$ button
201+
$ secondary
202+
$ resize ExtraLarge
203+
$ submit Loading
204+
$$$ [ R.text "Save" ]
182205
]
183206
]
184207
where

src/Lumi/Components/Color.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,6 @@ shade { hue, white, black } =
134134
hueDarkest = darken 0.15 hue
135135
hueDisabled = lighten 0.4137 $ desaturate 0.1972 hue
136136
grey1 = lighten 0.7 black
137-
grey2 = lighten 0.82 black
137+
grey2 = lighten 0.78 black
138138
in
139139
{ hue, hueDarker, hueDarkest, hueDisabled, grey1, grey2, white, black }

src/Lumi/Components2/Button.purs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ button = primary >>>
179179
$ merge
180180
[ css { position: absolute }
181181
, mkLoader
182-
{ color: colors.white
183-
, highlightColor: colors.transparent
182+
{ color: var "--button-hue-loader"
184183
, radius: px 16
185184
, borderWidth: px 2
186185
}
@@ -211,6 +210,7 @@ primary =
211210
{ color: varButtonWhite
212211
, borderColor: varButtonHue
213212
, backgroundColor: varButtonHue
213+
, "--button-hue-loader": varButtonWhite
214214
, "&:hover":
215215
nested
216216
$ css
@@ -244,6 +244,7 @@ secondary =
244244
{ color: varButtonBlack
245245
, borderColor: varButtonGrey1
246246
, backgroundColor: varButtonWhite
247+
, "--button-hue-loader": varButtonGrey1
247248
, "&:hover":
248249
nested
249250
$ css
@@ -261,8 +262,8 @@ secondary =
261262
, "&:disabled":
262263
nested
263264
$ css
264-
{ borderColor: varButtonGrey2
265-
, color: varButtonGrey1
265+
{ color: varButtonGrey1
266+
, borderColor: varButtonGrey2
266267
, backgroundColor: varButtonWhite
267268
}
268269
}
@@ -282,7 +283,7 @@ resize size =
282283
, padding: px2 6 16
283284
, height: px 28
284285
, "&[data-loading]":
285-
loadingStyles colors { radius: px 12, borderWidth: px 2 }
286+
loadingStyles { radius: px 12, borderWidth: px 2 }
286287
}
287288
Medium ->
288289
mempty
@@ -292,35 +293,34 @@ resize size =
292293
, padding: px2 12 24
293294
, height: px 48
294295
, "&[data-loading]":
295-
loadingStyles colors { radius: px 24, borderWidth: px 3 }
296+
loadingStyles { radius: px 24, borderWidth: px 3 }
296297
}
297298
ExtraLarge ->
298299
css
299300
{ fontSize: px fontSizes.sectionHeader
300301
, padding: px2 16 32
301302
, height: px 64
302303
, "&[data-loading]":
303-
loadingStyles colors { radius: px 34, borderWidth: px 4 }
304+
loadingStyles { radius: px 34, borderWidth: px 4 }
304305
}
305306
ExtraExtraLarge ->
306307
css
307308
{ fontSize: px fontSizes.sectionHeader
308309
, padding: px2 16 32
309310
, height: px 64
310311
, "&[data-loading]":
311-
loadingStyles colors { radius: px 34, borderWidth: px 4 }
312+
loadingStyles { radius: px 34, borderWidth: px 4 }
312313
}
313314
]
314315
}
315316
where
316-
loadingStyles colors { radius, borderWidth } =
317+
loadingStyles { radius, borderWidth } =
317318
nested
318319
$ css
319320
{ "&:after":
320321
nested
321322
$ mkLoader
322-
{ color: colors.white
323-
, highlightColor: colors.transparent
323+
{ color: var "--button-hue-loader"
324324
, radius
325325
, borderWidth
326326
}

src/Lumi/Styles/Loader.purs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
module Lumi.Styles.Loader where
22

33

4-
import Lumi.Components.Color (Color)
54
import Lumi.Styles (Style, StyleModifier, StyleProperty, borderBox, color, css, inlineBlock, keyframes, percent, px, solid, str, style)
65
import Lumi.Styles.Theme (LumiTheme(..))
76

87
loader :: StyleModifier
98
loader =
109
style \(LumiTheme { colors }) ->
1110
( mkLoader
12-
{ color: colors.black1
13-
, highlightColor: colors.black4
11+
{ color: color colors.black1
1412
, radius: px 38
1513
, borderWidth: px 5
1614
}
@@ -24,13 +22,12 @@ spin =
2422
}
2523

2624
mkLoader ::
27-
{ color :: Color
28-
, highlightColor :: Color
25+
{ color :: StyleProperty
2926
, radius :: StyleProperty
3027
, borderWidth :: StyleProperty
3128
} ->
3229
Style
33-
mkLoader { color: c, highlightColor, radius, borderWidth } =
30+
mkLoader { color: c, radius, borderWidth } =
3431
css
3532
{ boxSizing: borderBox
3633
, content: str "\"\""
@@ -39,8 +36,8 @@ mkLoader { color: c, highlightColor, radius, borderWidth } =
3936
, width: radius
4037
, borderWidth: borderWidth
4138
, borderStyle: solid
42-
, borderColor: color c
43-
, borderTopColor: color highlightColor
39+
, borderColor: c
40+
, borderTopColor: str "transparent"
4441
, borderRadius: percent 50.0
4542
, animation: str "1s infinite linear"
4643
, animationName: spin

0 commit comments

Comments
 (0)