Files
echecsfrance/utils/scrollHandlers.ts
T
2023-10-11 14:05:27 +02:00

9 lines
260 B
TypeScript

import { ScrollableElement } from "@/types";
const isBrowser = () => typeof window !== "undefined";
export const handleScrollToTop = (element: ScrollableElement | null) => {
if (!isBrowser()) return;
element?.scrollTo({ top: 0, behavior: "smooth" });
};