'use client' import React, { useState , useEffect } from "react"; import Link from "next/link"; import CartDropdown from "./CartDropdown"; import Sidebar from "./Sidebar"; import Image from "next/image"; import { useContextElement } from "@/context/Context"; const Header = () => { const [navbar, setNavbar] = useState(false); const [click, setClick] = useState(false); const handleClick = () => setClick(!click); const [click2, setClick2] = useState(false); const handleClick2 = () => setClick2(!click2); const {cartProducts} = useContextElement() const changeBackground = () => { if (window.scrollY >= 90) { setNavbar(true); } else { setNavbar(false); } }; useEffect(() => { window.addEventListener("scroll", changeBackground); return () => { window.removeEventListener("scroll", changeBackground); } }, []) return (