diff --git a/app/components/Navbar.tsx b/app/components/Navbar.tsx index c7068d6..e73e491 100644 --- a/app/components/Navbar.tsx +++ b/app/components/Navbar.tsx @@ -1,23 +1,39 @@ 'use client' -import { useState } from 'react' +import { useState, useRef, useEffect } from 'react' import Link from 'next/link' import Image from 'next/image' import { usePathname } from 'next/navigation' -import { Menu, X } from 'lucide-react' +import { Menu, X, ChevronDown } from 'lucide-react' +import { useSession, signOut } from 'next-auth/react' const Navbar = () => { const pathname = usePathname() const [isOpen, setIsOpen] = useState(false) + const [isProfileOpen, setIsProfileOpen] = useState(false) + const { data: session } = useSession() + const profileRef = useRef(null) + + // Close profile dropdown when clicking outside + useEffect(() => { + const handleClickOutside = (event: MouseEvent) => { + if (profileRef.current && !profileRef.current.contains(event.target as Node)) { + setIsProfileOpen(false); + } + }; + + document.addEventListener('mousedown', handleClickOutside); + return () => document.removeEventListener('mousedown', handleClickOutside); + }, []); const linkClasses = (path: string) => - `px-4 py-2 text-base font-normal transition-colors duration-200 ${ + `px-4 py-2 text-base font-medium transition-all duration-300 ${ pathname === path - ? 'underline decoration-2 underline-offset-4 text-black' - : 'text-black hover:text-afh-orange' - }` + ? 'underline decoration-2 underline-offset-4 text-afh-blue' + : 'text-afh-blue hover:text-afh-orange' + }`; return ( -