"use client"; import { Button } from "@/components/ui/button"; import { LogIn, Menu, Search } from "lucide-react"; import Image from "next/image"; import Link from "next/link"; import { useEffect, useState } from "react"; import { ModeToggle } from "./mode-toggle"; import ToggleLanguage from "./toggle-language"; import { Input } from "./ui/input"; export default function Header() { const [isScrollingUp, setIsScrollingUp] = useState(true); // Track scroll direction const [prevScrollPos, setPrevScrollPos] = useState(0); useEffect(() => { const handleScroll = () => { const currentScrollPos = window.scrollY; // Determine scroll direction if (currentScrollPos < prevScrollPos) { setIsScrollingUp(true); // Scrolling up } else { setIsScrollingUp(false); // Scrolling down } // Update previous scroll position setPrevScrollPos(currentScrollPos); }; // Attach scroll event listener window.addEventListener("scroll", handleScroll); // Cleanup listener on unmount return () => window.removeEventListener("scroll", handleScroll); }, [prevScrollPos]); return (
{/* Left Section */}
logo

پارچ کست

{/* Right Section */}
); }