|
|
|
@@ -1,160 +1,198 @@ |
|
|
|
import React, { useState, useMemo, useContext } from 'react'; |
|
|
|
import React, { useState, useMemo, useContext } from "react"; |
|
|
|
import { |
|
|
|
AppBar, |
|
|
|
Badge, |
|
|
|
Box, |
|
|
|
IconButton, |
|
|
|
Toolbar, |
|
|
|
Typography, |
|
|
|
List, |
|
|
|
ListItem, |
|
|
|
ListItemButton, |
|
|
|
ListItemIcon, |
|
|
|
ListItemText, |
|
|
|
useMediaQuery, |
|
|
|
} from '@mui/material'; |
|
|
|
import { useTheme } from '@mui/system'; |
|
|
|
import MenuOutlinedIcon from '@mui/icons-material/MenuOutlined'; |
|
|
|
import ShoppingBasketIcon from '@mui/icons-material/ShoppingBasket'; |
|
|
|
import Brightness4Icon from '@mui/icons-material/Brightness4'; |
|
|
|
import Brightness7Icon from '@mui/icons-material/Brightness7'; |
|
|
|
import MenuList from './MenuListComponent'; |
|
|
|
import Drawer from './DrawerComponent'; |
|
|
|
import { ColorModeContext } from '../../context/ColorModeContext'; |
|
|
|
AppBar, |
|
|
|
// Badge, |
|
|
|
Box, |
|
|
|
IconButton, |
|
|
|
Toolbar, |
|
|
|
Typography, |
|
|
|
List, |
|
|
|
ListItem, |
|
|
|
ListItemButton, |
|
|
|
ListItemIcon, |
|
|
|
ListItemText, |
|
|
|
useMediaQuery, |
|
|
|
} from "@mui/material"; |
|
|
|
import HrLogo from "../../assets/images/hrcenter.png"; |
|
|
|
import searchIcon from "../../assets/images/Vector.png"; |
|
|
|
import { useTheme } from "@mui/system"; |
|
|
|
import MenuOutlinedIcon from "@mui/icons-material/MenuOutlined"; |
|
|
|
// import ShoppingBasketIcon from "@mui/icons-material/ShoppingBasket"; |
|
|
|
import Brightness4Icon from "@mui/icons-material/Brightness4"; |
|
|
|
import Brightness7Icon from "@mui/icons-material/Brightness7"; |
|
|
|
// import MenuList from "./MenuListComponent"; |
|
|
|
import Drawer from "./DrawerComponent"; |
|
|
|
import { ColorModeContext } from "../../context/ColorModeContext"; |
|
|
|
import { useTranslation } from "react-i18next"; |
|
|
|
|
|
|
|
const NavbarComponent = () => { |
|
|
|
const [openDrawer, setOpenDrawer] = useState(false); |
|
|
|
const theme = useTheme(); |
|
|
|
const matches = useMediaQuery(theme.breakpoints.down('sm')); |
|
|
|
const toggleColorMode = useContext(ColorModeContext); |
|
|
|
const navItems = [ |
|
|
|
"ads", |
|
|
|
"selectionFlow", |
|
|
|
"candidates", |
|
|
|
"planer", |
|
|
|
"patterns", |
|
|
|
"stats", |
|
|
|
"users", |
|
|
|
]; |
|
|
|
const [openDrawer, setOpenDrawer] = useState(false); |
|
|
|
const theme = useTheme(); |
|
|
|
const matches = useMediaQuery(theme.breakpoints.down("sm")); |
|
|
|
const toggleColorMode = useContext(ColorModeContext); |
|
|
|
|
|
|
|
const handleToggleDrawer = () => { |
|
|
|
setOpenDrawer(!openDrawer); |
|
|
|
}; |
|
|
|
const { t } = useTranslation(); |
|
|
|
|
|
|
|
const drawerContent = useMemo( |
|
|
|
() => ( |
|
|
|
<List> |
|
|
|
<ListItemButton divider onClick={handleToggleDrawer}> |
|
|
|
<ListItemIcon> |
|
|
|
<ListItemText>Link 1</ListItemText> |
|
|
|
</ListItemIcon> |
|
|
|
</ListItemButton> |
|
|
|
<ListItem divider onClick={handleToggleDrawer}> |
|
|
|
<ListItemIcon> |
|
|
|
<ListItemText>Link 2</ListItemText> |
|
|
|
</ListItemIcon> |
|
|
|
</ListItem> |
|
|
|
<ListItem divider onClick={handleToggleDrawer}> |
|
|
|
<ListItemText>Link 3</ListItemText> |
|
|
|
</ListItem> |
|
|
|
<ListItem divider> |
|
|
|
<IconButton onClick={toggleColorMode}> |
|
|
|
<ListItemText>Toggle {theme.palette.mode} mode</ListItemText> |
|
|
|
{theme.palette.mode === 'dark' ? ( |
|
|
|
<Brightness7Icon /> |
|
|
|
) : ( |
|
|
|
<Brightness4Icon /> |
|
|
|
)} |
|
|
|
</IconButton> |
|
|
|
</ListItem> |
|
|
|
</List> |
|
|
|
), |
|
|
|
[handleToggleDrawer] |
|
|
|
); |
|
|
|
const handleToggleDrawer = () => { |
|
|
|
setOpenDrawer(!openDrawer); |
|
|
|
}; |
|
|
|
|
|
|
|
return ( |
|
|
|
<AppBar |
|
|
|
elevation={2} |
|
|
|
sx={{ backgroundColor: 'background.default', position: 'relative' }} |
|
|
|
> |
|
|
|
<Toolbar> |
|
|
|
<Box |
|
|
|
component="div" |
|
|
|
sx={{ |
|
|
|
display: 'flex', |
|
|
|
justifyContent: 'space-between', |
|
|
|
alignItems: 'center', |
|
|
|
width: '100%', |
|
|
|
}} |
|
|
|
> |
|
|
|
{matches ? ( |
|
|
|
<Drawer |
|
|
|
open={openDrawer} |
|
|
|
toggleOpen={handleToggleDrawer} |
|
|
|
content={drawerContent} |
|
|
|
/> |
|
|
|
) : ( |
|
|
|
<Box sx={{ display: 'flex' }}> |
|
|
|
<Typography |
|
|
|
variant="h6" |
|
|
|
sx={{ |
|
|
|
marginRight: 3, |
|
|
|
cursor: 'pointer', |
|
|
|
color: 'text.primary', |
|
|
|
}} |
|
|
|
> |
|
|
|
Link 1 |
|
|
|
</Typography> |
|
|
|
<Typography |
|
|
|
variant="body1" |
|
|
|
sx={{ |
|
|
|
marginRight: 3, |
|
|
|
cursor: 'pointer', |
|
|
|
color: 'text.primary', |
|
|
|
}} |
|
|
|
> |
|
|
|
Link 2 |
|
|
|
</Typography> |
|
|
|
<Typography |
|
|
|
variant="subtitle1" |
|
|
|
sx={{ |
|
|
|
marginRight: 3, |
|
|
|
cursor: 'pointer', |
|
|
|
color: 'text.primary', |
|
|
|
}} |
|
|
|
> |
|
|
|
Link 3 |
|
|
|
</Typography> |
|
|
|
</Box> |
|
|
|
)} |
|
|
|
<Box> |
|
|
|
<MenuList /> |
|
|
|
</Box> |
|
|
|
<Box |
|
|
|
sx={{ |
|
|
|
display: 'flex', |
|
|
|
justifyContent: 'center', |
|
|
|
alignItems: 'center', |
|
|
|
}} |
|
|
|
> |
|
|
|
{matches ? ( |
|
|
|
<Box> |
|
|
|
<IconButton onClick={handleToggleDrawer}> |
|
|
|
<MenuOutlinedIcon /> |
|
|
|
</IconButton> |
|
|
|
</Box> |
|
|
|
) : ( |
|
|
|
<Box> |
|
|
|
<IconButton> |
|
|
|
<Badge badgeContent={3} color="primary"> |
|
|
|
<ShoppingBasketIcon color="action" /> |
|
|
|
</Badge> |
|
|
|
</IconButton> |
|
|
|
<IconButton sx={{ ml: 1 }} onClick={toggleColorMode}> |
|
|
|
{theme.palette.mode === 'dark' ? ( |
|
|
|
<Brightness7Icon /> |
|
|
|
) : ( |
|
|
|
<Brightness4Icon /> |
|
|
|
)} |
|
|
|
</IconButton> |
|
|
|
</Box> |
|
|
|
)} |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
</Toolbar> |
|
|
|
</AppBar> |
|
|
|
); |
|
|
|
const drawerContent = useMemo( |
|
|
|
() => ( |
|
|
|
<List> |
|
|
|
{navItems.map((n) => ( |
|
|
|
<ListItemButton key={n} divider onClick={handleToggleDrawer}> |
|
|
|
<ListItemIcon> |
|
|
|
<ListItemText |
|
|
|
variant="body1" |
|
|
|
sx={{ |
|
|
|
marginRight: "50px", |
|
|
|
cursor: "pointer", |
|
|
|
textAlign: "right", |
|
|
|
lineHeight: "20.11px", |
|
|
|
fontWeight: "400", |
|
|
|
color: "text.primary", |
|
|
|
marginY: "0", |
|
|
|
padding: "0", |
|
|
|
}} |
|
|
|
className="text-black" |
|
|
|
> |
|
|
|
{t("nav." + n)} |
|
|
|
</ListItemText> |
|
|
|
</ListItemIcon> |
|
|
|
</ListItemButton> |
|
|
|
))} |
|
|
|
<ListItem divider> |
|
|
|
<IconButton onClick={toggleColorMode}> |
|
|
|
<ListItemText>Toggle {theme.palette.mode} mode</ListItemText> |
|
|
|
{theme.palette.mode === "dark" ? ( |
|
|
|
<Brightness7Icon /> |
|
|
|
) : ( |
|
|
|
<Brightness4Icon /> |
|
|
|
)} |
|
|
|
</IconButton> |
|
|
|
</ListItem> |
|
|
|
</List> |
|
|
|
), |
|
|
|
[handleToggleDrawer] |
|
|
|
); |
|
|
|
|
|
|
|
return ( |
|
|
|
<AppBar |
|
|
|
elevation={0} |
|
|
|
sx={{ |
|
|
|
backgroundColor: "transparent", |
|
|
|
position: "relative", |
|
|
|
width: "100%", |
|
|
|
padding: "0", |
|
|
|
}} |
|
|
|
> |
|
|
|
<Toolbar |
|
|
|
sx={{ |
|
|
|
padding: "0px", |
|
|
|
margin: "0px", |
|
|
|
width: "100%", |
|
|
|
}} |
|
|
|
> |
|
|
|
<Box |
|
|
|
component="div" |
|
|
|
sx={{ |
|
|
|
display: "flex", |
|
|
|
justifyContent: "space-between", |
|
|
|
alignItems: "center", |
|
|
|
width: "100%", |
|
|
|
padding: "0px", |
|
|
|
margin: "0px", |
|
|
|
// md: {paddingX: "72px"} |
|
|
|
// paddingX: "72px" |
|
|
|
}} |
|
|
|
> |
|
|
|
<Box |
|
|
|
sx={{ |
|
|
|
display: "flex", |
|
|
|
justifyContent: "center", |
|
|
|
alignItems: "center", |
|
|
|
}} |
|
|
|
> |
|
|
|
{matches ? ( |
|
|
|
<Box> |
|
|
|
<IconButton onClick={handleToggleDrawer}> |
|
|
|
<MenuOutlinedIcon /> |
|
|
|
</IconButton> |
|
|
|
</Box> |
|
|
|
) : ( |
|
|
|
<Box> |
|
|
|
{/* <IconButton onClick={handleToggleDrawer}> |
|
|
|
<MenuOutlinedIcon /> |
|
|
|
</IconButton> */} |
|
|
|
<img |
|
|
|
style={{ height: "37px", width: "37px", marginLeft: "72px" }} |
|
|
|
src={HrLogo} |
|
|
|
/> |
|
|
|
</Box> |
|
|
|
)} |
|
|
|
</Box> |
|
|
|
{matches ? ( |
|
|
|
<Drawer |
|
|
|
open={openDrawer} |
|
|
|
toggleOpen={handleToggleDrawer} |
|
|
|
content={drawerContent} |
|
|
|
/> |
|
|
|
) : ( |
|
|
|
<Box |
|
|
|
sx={{ |
|
|
|
display: "flex", |
|
|
|
alignItems: "center", |
|
|
|
paddingRight: "20px", |
|
|
|
justifyContent: "flex-end", |
|
|
|
height: "81px", |
|
|
|
width: "1076px", |
|
|
|
borderBottom: "1px solid #F4F4F4", |
|
|
|
boxSizing: "border-box", |
|
|
|
}} |
|
|
|
className="navLinks-cont" |
|
|
|
> |
|
|
|
{navItems.map((n) => ( |
|
|
|
<Typography |
|
|
|
variant="body1" |
|
|
|
key={n} |
|
|
|
sx={{ |
|
|
|
marginRight: "50px", |
|
|
|
cursor: "pointer", |
|
|
|
textAlign: "right", |
|
|
|
lineHeight: "20.11px", |
|
|
|
fontWeight: "400", |
|
|
|
// color: "text.primary", |
|
|
|
marginY: "0", |
|
|
|
padding: "0", |
|
|
|
}} |
|
|
|
className="text-black" |
|
|
|
> |
|
|
|
{t("nav." + n)} |
|
|
|
</Typography> |
|
|
|
))} |
|
|
|
<div className="search-Icon"> |
|
|
|
<img src={searchIcon} /> |
|
|
|
</div> |
|
|
|
<div className="full-rounded">DR</div> |
|
|
|
</Box> |
|
|
|
)} |
|
|
|
{/* <Box> |
|
|
|
<MenuList /> |
|
|
|
</Box> */} |
|
|
|
</Box> |
|
|
|
</Toolbar> |
|
|
|
</AppBar> |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
export default NavbarComponent; |