"use client" import * as React from "react" import { ArrowUp } from "lucide-react" import { motion, AnimatePresence } from "framer-motion" import { useLanguage } from "@/lib/language-context" import { cn } from "@/lib/utils" const ScrollToTop = () => { const { language } = useLanguage() const [isVisible, setIsVisible] = React.useState(false) React.useEffect(() => { const toggleVisibility = () => { if (window.scrollY > 300) { setIsVisible(true) } else { setIsVisible(false) } } window.addEventListener("scroll", toggleVisibility) return () => window.removeEventListener("scroll", toggleVisibility) }, []) const scrollToTop = () => { window.scrollTo({ top: 0, behavior: "smooth", }) } return ( {isVisible && ( )} ) } export default ScrollToTop