From b6b3a7d4223d6ddd8c210b483e1e49be0cebe07a Mon Sep 17 00:00:00 2001 From: Sonika Date: Wed, 27 Dec 2023 13:04:34 +0530 Subject: [PATCH] Header alignment , style and optimization --- src/components/Header.tsx | 235 ++++++++++++++------------------------ 1 file changed, 83 insertions(+), 152 deletions(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index dec4756..011748d 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { Link, useLocation } from 'react-router-dom'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; @@ -9,58 +10,42 @@ import MenuIcon from '@mui/icons-material/Menu'; import Container from '@mui/material/Container'; import Avatar from '@mui/material/Avatar'; import Button from '@mui/material/Button'; -import Tooltip from '@mui/material/Tooltip'; import MenuItem from '@mui/material/MenuItem'; -import AdbIcon from '@mui/icons-material/Adb'; -import Grid from '@mui/material/Grid'; -import { Link } from 'react-router-dom'; - -const pages = ['HOME','PROJECTS', 'SEARCH', 'ADMIN','MANAGE USERS','INTRANET USERS']; -const settings = ['Profile', 'Account', 'Dashboard', 'Logout']; function Header() { const [anchorElNav, setAnchorElNav] = React.useState(null); - const [anchorElUser, setAnchorElUser] = React.useState(null); + const location = useLocation(); - const handleOpenNavMenu = (event:any) => { + const handleOpenNavMenu = (event: any) => { setAnchorElNav(event.currentTarget); }; - const handleOpenUserMenu = (event:any) => { - setAnchorElUser(event.currentTarget); - }; const handleCloseNavMenu = () => { setAnchorElNav(null); }; - const handleCloseUserMenu = () => { - setAnchorElUser(null); - }; - return ( - + + + + + logo + - - - - - - @@ -89,130 +75,75 @@ function Header() { display: { xs: 'block', md: 'none' }, }} > - {/* {pages.map((page) => ( - - {page} - - ))} */} - - HOME - - - PROJECTS - - - MANAGE USERS - - - INTRANET USERS - + {/* ... (existing code) */} - - - - - - {/* {pages.map((page) => ( - - ))} */} + - - - + key="home" + onClick={handleCloseNavMenu} + sx={{ + mx: 2, + color: 'white', + borderBottom: location.pathname === '/' ? '2px solid red' : 'none', + }} + component={Link} + to="/" + > + HOME + + + + - - - - - Riveesh - - - - {settings.map((setting) => ( - - {setting} - - ))} - + + + + Riveesh + ); } -export default Header; \ No newline at end of file + +export default Header;