Merge branch 'register-page' of https://github.com/MuhammadKhalilzadeh/bluewave-uptime into register-page
This commit is contained in:
commit
a1b3c14560
1 file changed
+125
-35
@@ -1,48 +1,138 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import './index.css';
|
import AppBar from '@mui/material/AppBar';
|
||||||
import Button from '@mui/material/Button';
|
import Box from '@mui/material/Box';
|
||||||
|
import Toolbar from '@mui/material/Toolbar';
|
||||||
|
import IconButton from '@mui/material/IconButton';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
import Menu from '@mui/material/Menu';
|
import Menu from '@mui/material/Menu';
|
||||||
|
import MenuIcon from '@mui/icons-material/Menu';
|
||||||
|
import Container from '@mui/material/Container';
|
||||||
|
import Avatar from '@mui/material/Avatar';
|
||||||
|
import Tooltip from '@mui/material/Tooltip';
|
||||||
import MenuItem from '@mui/material/MenuItem';
|
import MenuItem from '@mui/material/MenuItem';
|
||||||
|
import { useTheme } from '@mui/material/styles';
|
||||||
|
|
||||||
const NavBar = () => {
|
const settings = ['Profile', 'Team', 'Invite Colleagues', 'Logout'];
|
||||||
const [anchorEl, setAnchorEl] = useState(null);
|
|
||||||
const open = Boolean(anchorEl);
|
|
||||||
|
|
||||||
const handleClick = (event) => {
|
/**
|
||||||
setAnchorEl(event.currentTarget);
|
* NavBar component
|
||||||
};
|
*
|
||||||
|
* A responsive navigation bar component with a user menu.
|
||||||
|
*
|
||||||
|
* @component
|
||||||
|
* @example
|
||||||
|
* return (
|
||||||
|
* <NavBar />
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
function NavBar() {
|
||||||
|
const theme = useTheme();
|
||||||
|
const [anchorElUser, setAnchorElUser] = useState(null);
|
||||||
|
|
||||||
const handleClose = () => {
|
/**
|
||||||
setAnchorEl(null);
|
* Handles opening the user menu.
|
||||||
};
|
*
|
||||||
|
* @param {React.MouseEvent<HTMLElement>} event - The event triggered by clicking the user menu button.
|
||||||
|
*/
|
||||||
|
const handleOpenUserMenu = (event) => {
|
||||||
|
setAnchorElUser(event.currentTarget);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
/**
|
||||||
<div>
|
* Handles closing the user menu.
|
||||||
<Button
|
*/
|
||||||
id="basic-button"
|
const handleCloseUserMenu = () => {
|
||||||
aria-controls={open ? 'basic-menu' : undefined}
|
setAnchorElUser(null);
|
||||||
aria-haspopup="true"
|
};
|
||||||
aria-expanded={open ? 'true' : undefined}
|
|
||||||
onClick={handleClick}
|
return (
|
||||||
|
<AppBar position="static">
|
||||||
|
<Container maxWidth="xl">
|
||||||
|
<Toolbar disableGutters>
|
||||||
|
<Typography
|
||||||
|
variant="h6"
|
||||||
|
noWrap
|
||||||
|
component="a"
|
||||||
|
href="#"
|
||||||
|
sx={{
|
||||||
|
mr: 2,
|
||||||
|
display: { xs: 'none', md: 'flex' },
|
||||||
|
fontFamily: 'monospace',
|
||||||
|
fontWeight: theme.typography.fontWeightBold,
|
||||||
|
letterSpacing: theme.spacing(0.3),
|
||||||
|
color: 'inherit',
|
||||||
|
textDecoration: 'none',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
UPTIME GENIE
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<Box sx={{ flexGrow: 1, display: { xs: 'flex', md: 'none' } }}>
|
||||||
|
<IconButton
|
||||||
|
size="large"
|
||||||
|
aria-label="account of current user"
|
||||||
|
aria-controls="menu-appbar"
|
||||||
|
aria-haspopup="true"
|
||||||
|
color="inherit"
|
||||||
>
|
>
|
||||||
Jackie Dawn
|
<MenuIcon />
|
||||||
</Button>
|
</IconButton>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Typography
|
||||||
|
variant="h5"
|
||||||
|
noWrap
|
||||||
|
component="a"
|
||||||
|
href="#"
|
||||||
|
sx={{
|
||||||
|
mr: 2,
|
||||||
|
display: { xs: 'flex', md: 'none' },
|
||||||
|
flexGrow: 1,
|
||||||
|
fontFamily: 'monospace',
|
||||||
|
fontWeight: theme.typography.fontWeightBold,
|
||||||
|
letterSpacing: theme.spacing(0.3),
|
||||||
|
color: 'inherit',
|
||||||
|
textDecoration: 'none',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
UPTIME GENIE
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<Box sx={{ flexGrow: 1 }} />
|
||||||
|
|
||||||
|
<Box sx={{ flexGrow: 0 }}>
|
||||||
|
<Tooltip title="Open settings">
|
||||||
|
<IconButton onClick={handleOpenUserMenu} sx={{ p: 0 }}>
|
||||||
|
<Avatar alt="Remy Sharp" src="/static/images/avatar/2.jpg" />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
<Menu
|
<Menu
|
||||||
id="basic-menu"
|
sx={{ mt: theme.spacing(5.5) }}
|
||||||
anchorEl={anchorEl}
|
id="menu-appbar"
|
||||||
open={open}
|
anchorEl={anchorElUser}
|
||||||
onClose={handleClose}
|
anchorOrigin={{
|
||||||
MenuListProps={{
|
vertical: 'top',
|
||||||
'aria-labelledby': 'basic-button',
|
horizontal: 'right',
|
||||||
}}
|
}}
|
||||||
|
keepMounted
|
||||||
|
transformOrigin={{
|
||||||
|
vertical: 'top',
|
||||||
|
horizontal: 'right',
|
||||||
|
}}
|
||||||
|
open={Boolean(anchorElUser)}
|
||||||
|
onClose={handleCloseUserMenu}
|
||||||
>
|
>
|
||||||
<MenuItem onClick={handleClose}>Profile</MenuItem>
|
{settings.map((setting) => (
|
||||||
<MenuItem onClick={handleClose}>Team</MenuItem>
|
<MenuItem key={setting} onClick={handleCloseUserMenu}>
|
||||||
<MenuItem onClick={handleClose}>Invite Colleagues</MenuItem>
|
<Typography textAlign="center">{setting}</Typography>
|
||||||
<MenuItem onClick={handleClose}>Log Out</MenuItem>
|
</MenuItem>
|
||||||
|
))}
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</Box>
|
||||||
);
|
</Toolbar>
|
||||||
};
|
</Container>
|
||||||
|
</AppBar>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export default NavBar;
|
export default NavBar;
|
||||||
Reference in new issue
Block a user