"use client"; import Image from "next/image"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useContext, useEffect, useRef, useState } from "react"; import GlobalContext from "@/context/GlobalContext"; import close from "@/public/close-white.svg"; const MobileMenu = () => { const path = usePathname() ?? "/"; const { burgerOpen, setBurgerOpen } = useContext(GlobalContext).burgerContext; const onClickCloseBurgerHandler = () => { setBurgerOpen(false); }; const [dropDownOpened, setDropDownOpened] = useState(false); const dropdownRef = useRef(null); useEffect(() => { const handleOutsideClick = (event: MouseEvent) => { if ( dropdownRef.current && !dropdownRef.current.contains(event.target as Node) ) { setDropDownOpened(false); } }; // Attach the event listener to the document document.addEventListener("click", handleOutsideClick); // Cleanup the event listener when the component unmounts return () => { document.removeEventListener("click", handleOutsideClick); }; }, []); return ( <> {burgerOpen && (
logo
setBurgerOpen(false)} > menu
    {/*
  • onClickCloseBurgerHandler()} href={'/news'} style={path.includes('news') ? { color: '#FFAB48' } : {}}> Habarlar
  • */}
  • onClickCloseBurgerHandler()} className="block text-3xl text-white transition-all font-roboto font-bold dark:text-white" style={ path.includes("treasury") || path.includes("video/") ? { color: "#FFAB48" } : {} } > Hazyna
  • onClickCloseBurgerHandler()} className="block text-3xl text-white transition-all font-roboto font-bold dark:text-white" style={path.includes("live") ? { color: "#FFAB48" } : {}} > Göni Ýaýlym
  • onClickCloseBurgerHandler()} className="block text-3xl text-white transition-all font-roboto font-bold dark:text-white" style={path.includes("advert") ? { color: "#FFAB48" } : {}} > Mahabat
  • onClickCloseBurgerHandler()} style={ path.includes("contact_us") ? { color: "#FFAB48" } : {} } className="font-roboto font-bold text-white text-3xl dark:text-white transition-all" > Habarlaşmak üçin
  • setDropDownOpened(!dropDownOpened)} >
    Interaktiw
    { setDropDownOpened(false); onClickCloseBurgerHandler(); }} > Bäsleşik { setDropDownOpened(false); onClickCloseBurgerHandler(); }} > Ses bermek { setDropDownOpened(false); onClickCloseBurgerHandler(); }} > TV market { setDropDownOpened(false); onClickCloseBurgerHandler(); }} > Sowgatlar { setDropDownOpened(false); onClickCloseBurgerHandler(); }} > Bije
  • onClickCloseBurgerHandler()} className="font-roboto font-bold text-white text-3xl dark:text-white transition-all p-2 bg-red-500 rounded-lg " > Ýaýlym tertibi
)} ); }; export default MobileMenu;