import { useState, useEffect, useRef } from 'react' import { Link, useLocation } from 'react-router-dom' import { motion, AnimatePresence } from 'framer-motion' import { HiMenu, HiX } from 'react-icons/hi' const Navbar = () => { const [isOpen, setIsOpen] = useState(false) const menuRef = useRef(null) const location = useLocation() const navItems = [ { name: 'Home', path: '/' }, { name: 'Services', path: '/services' }, { name: 'About', path: '/about' }, { name: 'Resources', path: '/resources' }, { name: 'Contact', path: '/contact' } ] useEffect(() => { const handleClickOutside = (event: MouseEvent) => { if (menuRef.current && !menuRef.current.contains(event.target as Node)) { setIsOpen(false) } } document.addEventListener('mousedown', handleClickOutside) return () => document.removeEventListener('mousedown', handleClickOutside) }, []) // Close mobile menu when route changes useEffect(() => { setIsOpen(false) }, [location]) return ( ) } export default Navbar