import { useState, useEffect } from "react"; import { Menu, X } from "lucide-react"; import { motion, AnimatePresence } from "framer-motion"; import { Button } from "./ui/button"; import { Sheet, SheetContent, SheetTrigger } from "./ui/sheet"; export default function Header() { const [isVisible, setIsVisible] = useState(true); const [lastScrollY, setLastScrollY] = useState(0); const [isOpen, setIsOpen] = useState(false); useEffect(() => { const handleScroll = () => { const currentScrollY = window.scrollY; if (currentScrollY < 50) { setIsVisible(true); } else if (currentScrollY > lastScrollY) { setIsVisible(false); } else { setIsVisible(true); } setLastScrollY(currentScrollY); }; window.addEventListener("scroll", handleScroll, { passive: true }); return () => window.removeEventListener("scroll", handleScroll); }, [lastScrollY]); const scrollToSection = (id: string) => { const element = document.getElementById(id); if (element) { element.scrollIntoView({ behavior: "smooth" }); setIsOpen(false); } }; const navItems = [ { label: "About Us", id: "about" }, { label: "Why Trust Us", id: "trust" }, { label: "Connect", id: "contact" }, ]; return (
{/* Logo */}
ChopFresh Logo
{/* Desktop Navigation */} {/* Mobile Menu */}
); }