"use client"; import { useState, useEffect } from "react"; import Link from "next/link"; import Image from "next/image"; import { AnimatePresence, motion } from "framer-motion"; import { useSaleorCheckoutStore } from "@/stores/saleorCheckoutStore"; import { User, ShoppingBag, Menu, X } from "lucide-react"; import CartDrawer from "@/components/cart/CartDrawer"; const navLinks = [ { href: "/products", label: "Products" }, { href: "/about", label: "About" }, { href: "/contact", label: "Contact" }, ]; export default function Header() { const [mobileMenuOpen, setMobileMenuOpen] = useState(false); const [scrolled, setScrolled] = useState(false); const { getLineCount, toggleCart, initCheckout } = useSaleorCheckoutStore(); const itemCount = getLineCount(); // Initialize checkout on mount useEffect(() => { initCheckout(); }, [initCheckout]); // Track scroll for header styling useEffect(() => { const handleScroll = () => { setScrolled(window.scrollY > 50); }; window.addEventListener("scroll", handleScroll); return () => window.removeEventListener("scroll", handleScroll); }, []); // Lock body scroll when mobile menu is open useEffect(() => { if (mobileMenuOpen) { document.body.style.overflow = "hidden"; } else { document.body.style.overflow = ""; } return () => { document.body.style.overflow = ""; }; }, [mobileMenuOpen]); return ( <>
{/* Mobile Menu Button */} {/* Left side - Desktop Nav */} {/* Logo - Centered (absolute on desktop, flex on mobile) */} ManoonOils {/* Right side - Icons */}
{/* Mobile Menu Overlay */} {mobileMenuOpen && (
{/* Mobile Header */}
setMobileMenuOpen(false)}> ManoonOils
{/* Mobile Navigation */} {/* Mobile Footer */}
)}
); }