diff --git a/Frontend/src/pages/nav.js b/Frontend/src/pages/nav.js index 7d5ad94..36ed32b 100644 --- a/Frontend/src/pages/nav.js +++ b/Frontend/src/pages/nav.js @@ -1,97 +1,62 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; import Link from "next/link"; +const NavBar = () => { + const [currentPath, setCurrentPath] = useState(''); + useEffect(() => { + // This code runs only in the browser + setCurrentPath(window.location.pathname); + }, []); -const NavBar = () => { const handleLogout = () => { - // Set the 'token' cookie to expire immediately, effectively logging the user out - document.cookie = "token=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;"; - - - + // Set the 'token' cookie to expire immediately, effectively logging the user out + document.cookie = "token=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;"; }; + const NavLink = ({ href, children }) => ( + + + {children} + + + ); + return ( - {/* Left side - Logo and Navbar items */} - {/* Brand Logo */} - + PicturePerfect - + - {/* Primary Navbar items */} - - - Vote - - - - - Portfolio - - - - - Leaderboard - - - - - Create - - + Vote + Portfolio + Leaderboard + Create - {/* Right side - Logout Button */} - - Logout - + + Logout + - {/* Mobile menu */} - - - - - Vote - - - - - - - Portfolio - - - - - - - Leaderboard - - - - - - - Create - - - + + Vote + Portfolio + Leaderboard + Create