mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-23 09:51:10 +01:00
Fix sidebar scroll into view
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export function useScrollIntoView<T extends HTMLElement>(node: T | null, active: boolean) {
|
||||
export function useScrollIntoView<T extends HTMLElement>(node: T | null, enabled: boolean) {
|
||||
useEffect(() => {
|
||||
if (active) {
|
||||
node?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
if (enabled) {
|
||||
node?.scrollIntoView({ block: 'nearest' });
|
||||
}
|
||||
}, [active, node]);
|
||||
}, [enabled, node]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user