File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ styles = jss
221
221
}
222
222
, " &[data-color=\" secondary\" ]" :
223
223
{ extend: buttonSecondary
224
- , backgroundColor: cssStringHSLA colors.transparent
224
+ , backgroundColor: cssStringHSLA colors.white
225
225
, " &:hover" :
226
226
{ color: cssStringHSLA colors.primary
227
227
, borderColor: cssStringHSLA colors.primary
@@ -296,7 +296,7 @@ styles = jss
296
296
}
297
297
298
298
buttonSecondary =
299
- { backgroundColor: cssStringHSLA colors.transparent
299
+ { backgroundColor: cssStringHSLA colors.white
300
300
, color: cssStringHSLA colors.black
301
301
, border: [ " 1px" , " solid" , cssStringHSLA colors.black3 ]
302
302
}
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ dropdownButton =
67
67
initialState =
68
68
{ isOpen: false
69
69
, root: Nothing
70
+ , width: 0.0
70
71
, position:
71
72
{ bottom: 0.0
72
73
, left: 0.0
@@ -110,9 +111,10 @@ dropdownButton =
110
111
then close self
111
112
else do
112
113
p <- getAbsolutePosition el
114
+ d <- getDimensions el
113
115
when state.isOpen $
114
116
void $ requestAnimationFrame (capturePosition self ref (Just p0')) =<< HTML .window
115
- self.setState _{ position = p }
117
+ self.setState _{ position = p, width = d.width }
116
118
117
119
toggleOpen self refM = do
118
120
self.setStateThen
@@ -149,6 +151,7 @@ dropdownButton =
149
151
{ style: R .mergeStyles
150
152
[ R .css
151
153
{ top: show (state.position.bottom + 4.0 ) <> " px"
154
+ , minWidth: show state.width <> " px"
152
155
}
153
156
, if maybe false (_ == " right" ) (toMaybe props.alignment) then
154
157
R .css { left: " auto" , right: show (state.position.right - 1.0 ) <> " px" }
@@ -269,6 +272,14 @@ dropdownIcon props =
269
272
270
273
foreign import checkIsEventTargetInTree :: EffectFn2 Node Event Boolean
271
274
275
+ getDimensions :: HTML.HTMLElement -> Effect { width :: Number , height :: Number }
276
+ getDimensions el = do
277
+ { width, height } <- HTML .getBoundingClientRect el
278
+ pure
279
+ { width: width
280
+ , height: height
281
+ }
282
+
272
283
getAbsolutePosition :: HTML.HTMLElement -> Effect { bottom :: Number , left :: Number , right :: Number }
273
284
getAbsolutePosition el = do
274
285
window <- HTML .window
You can’t perform that action at this time.
0 commit comments