fix: reposition toggle sidebar button into view on window height reduce

This commit is contained in:
EnixCoda 2022-03-27 23:43:24 +08:00
parent edc8d32aac
commit 4f35c36054

View file

@ -37,11 +37,14 @@ export function ToggleShowButton({ error, className, onClick, onHover }: Props)
[distance],
)
// reposition on window height change, but ignores distance change
React.useEffect(() => {
if (ref.current) {
ref.current.style.top = distance + 'px'
}
}, [])
}, [height])
// And this repositions on drag
const { onPointerDown } = useResizeHandler(
[distance, distance],
([, y]) => {