File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ styles = jss
221221 }
222222 , " &[data-color=\" secondary\" ]" :
223223 { extend: buttonSecondary
224- , backgroundColor: cssStringHSLA colors.transparent
224+ , backgroundColor: cssStringHSLA colors.white
225225 , " &:hover" :
226226 { color: cssStringHSLA colors.primary
227227 , borderColor: cssStringHSLA colors.primary
@@ -296,7 +296,7 @@ styles = jss
296296 }
297297
298298 buttonSecondary =
299- { backgroundColor: cssStringHSLA colors.transparent
299+ { backgroundColor: cssStringHSLA colors.white
300300 , color: cssStringHSLA colors.black
301301 , border: [ " 1px" , " solid" , cssStringHSLA colors.black3 ]
302302 }
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ dropdownButton =
6767 initialState =
6868 { isOpen: false
6969 , root: Nothing
70+ , width: 0.0
7071 , position:
7172 { bottom: 0.0
7273 , left: 0.0
@@ -110,9 +111,10 @@ dropdownButton =
110111 then close self
111112 else do
112113 p <- getAbsolutePosition el
114+ d <- getDimensions el
113115 when state.isOpen $
114116 void $ requestAnimationFrame (capturePosition self ref (Just p0')) =<< HTML .window
115- self.setState _{ position = p }
117+ self.setState _{ position = p, width = d.width }
116118
117119 toggleOpen self refM = do
118120 self.setStateThen
@@ -149,6 +151,7 @@ dropdownButton =
149151 { style: R .mergeStyles
150152 [ R .css
151153 { top: show (state.position.bottom + 4.0 ) <> " px"
154+ , minWidth: show state.width <> " px"
152155 }
153156 , if maybe false (_ == " right" ) (toMaybe props.alignment) then
154157 R .css { left: " auto" , right: show (state.position.right - 1.0 ) <> " px" }
@@ -269,6 +272,14 @@ dropdownIcon props =
269272
270273foreign import checkIsEventTargetInTree :: EffectFn2 Node Event Boolean
271274
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+
272283getAbsolutePosition :: HTML.HTMLElement -> Effect { bottom :: Number , left :: Number , right :: Number }
273284getAbsolutePosition el = do
274285 window <- HTML .window
You can’t perform that action at this time.
0 commit comments