/* eslint-disable jsx-a11y/click-events-have-key-events */ /* eslint-disable jsx-a11y/control-has-associated-label */ /* eslint-disable jsx-a11y/interactive-supports-focus */ "use client"; import type { ComponentProps } from "react"; import { useEffect, useState } from "react"; import LIcon from "@/components/ui/lucid-icon/lucid-icon"; import { cn } from "@/libs/utils"; function ScrollToTop(props: ComponentProps<"div">) { const [showButton, setShowButton] = useState(false); useEffect(() => { const handleScroll = () => { const scrollTop = window.pageYOffset || document.documentElement.scrollTop; setShowButton(scrollTop > 100); }; window.addEventListener("scroll", handleScroll); return () => { window.removeEventListener("scroll", handleScroll); }; }, []); return (
{ window.scrollTo({ top: 0, behavior: "smooth" }); }} >
); } export default ScrollToTop;