mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-05-16 12:47:15 +02:00
Split codebase (#455)
This commit is contained in:
9
apps/yaak-client/hooks/useScrollIntoView.ts
Normal file
9
apps/yaak-client/hooks/useScrollIntoView.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { useEffect } from "react";
|
||||
|
||||
export function useScrollIntoView<T extends HTMLElement>(node: T | null, enabled: boolean) {
|
||||
useEffect(() => {
|
||||
if (enabled) {
|
||||
node?.scrollIntoView({ block: "nearest" });
|
||||
}
|
||||
}, [enabled, node]);
|
||||
}
|
||||
Reference in New Issue
Block a user