Changeset 0c6b92a for imaps-frontend/src/pages/IMaps/components/Navbar.jsx
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/src/pages/IMaps/components/Navbar.jsx
rd565449 r0c6b92a 1 import React, { useState, useEffect } from "react"; 2 import { Button } from "./Button"; 1 import React, {useContext, useState} from "react"; 2 import { Link } from "react-router-dom"; 3 import logo_icon from "../../../assets/logo_icon.png"; 4 //import { AuthContext } from "../../../components/AuthContext/AuthContext"; 5 import Logo from "../../../components/Logo/Logo.jsx"; 6 import Profile from "../../../components/Profile/Profile.jsx"; 7 import {useAppContext} from "../../../components/AppContext/AppContext.jsx"; 3 8 import "./Navbar.css"; 4 import { Link } from "react-router-dom";5 import logo from "../../../assets/logo_icon.png";6 9 7 10 function Navbar() { … … 12 15 const closeMobileMenu = () => setClick(false); 13 16 14 const showButton = () => { 15 if (window.innerWidth <= 960) { 16 setButton(false); 17 } else { 18 setButton(true); 19 } 20 }; 17 const { isAuthenticated } = useAppContext(); 21 18 22 useEffect(() => { 23 showButton(); 24 }, []); 19 return ( 20 <nav className="modern-navbar"> 21 <div className="navbar-container"> 22 {/* Left Section - Logo and Title */} 23 <div className="navbar-left"> 24 <Logo position="relative"/> 25 <h1 className="navbar-title">iMaps</h1> 26 </div> 25 27 26 window.addEventListener("resize", showButton); 27 28 return ( 29 <> 30 <nav className="navbar"> 31 <div className="navbar-container"> 32 <a href="#" className="navbar-logo pad-bot" onClick={closeMobileMenu}> 33 iMaps 34 </a> 35 <div className="menu-icon" onClick={handleClick}> 36 <i className={click ? "fas fa-times" : "fas fa-bars"} /> 37 </div> 38 <ul className={click ? "nav-menu active" : "nav-menu"}> 39 <Link to="/Signup"> 40 <li className="nav-item"> 41 <a href="#" className="nav-links" onClick={closeMobileMenu}> 42 SignUp 43 </a> 44 </li> 45 </Link> 46 </ul> 47 <div className="pad-bot"> 48 <Link to="/Login">{button && <Button buttonStyle="btn--outline">LOG IN</Button>}</Link> 49 </div> 50 </div> 51 </nav> 52 </> 53 ); 28 {/* Right Section - Login/Signup or Profile */} 29 <div className="navbar-right"> 30 {isAuthenticated ? ( 31 <Profile position="relative"/> 32 ) : ( 33 <> 34 <Link to="/Login" className="navbar-btn navbar-login"> 35 Log In 36 </Link> 37 <Link to="/Signup" className="navbar-btn navbar-signup"> 38 Sign Up 39 </Link> 40 </> 41 )} 42 </div> 43 </div> 44 </nav> 45 ); 54 46 } 55 47
Note:
See TracChangeset
for help on using the changeset viewer.