File size: 2,018 Bytes
95b5a04 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | // material-ui
import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import Avatar from '@mui/material/Avatar';
import Box from '@mui/material/Box';
// project imports
import LogoSection from '../LogoSection';
import SearchSection from './SearchSection';
import ProfileSection from './ProfileSection';
import NotificationSection from './NotificationSection';
import { handlerDrawerOpen, useGetMenuMaster } from 'api/menu';
// assets
import { IconMenu2 } from '@tabler/icons-react';
// ==============================|| MAIN NAVBAR / HEADER ||============================== //
export default function Header() {
const theme = useTheme();
const downMD = useMediaQuery(theme.breakpoints.down('md'));
const { menuMaster } = useGetMenuMaster();
const drawerOpen = menuMaster.isDashboardDrawerOpened;
return (
<>
{/* logo & toggler button */}
<Box sx={{ width: downMD ? 'auto' : 228, display: 'flex' }}>
<Box component="span" sx={{ display: { xs: 'none', md: 'block' }, flexGrow: 1 }}>
<LogoSection />
</Box>
<Avatar
variant="rounded"
sx={{
...theme.typography.commonAvatar,
...theme.typography.mediumAvatar,
overflow: 'hidden',
transition: 'all .2s ease-in-out',
color: theme.vars.palette.secondary.dark,
background: theme.vars.palette.secondary.light,
'&:hover': {
color: theme.vars.palette.secondary.light,
background: theme.vars.palette.secondary.dark
}
}}
onClick={() => handlerDrawerOpen(!drawerOpen)}
>
<IconMenu2 stroke={1.5} size="20px" />
</Avatar>
</Box>
{/* header search */}
<SearchSection />
<Box sx={{ flexGrow: 1 }} />
<Box sx={{ flexGrow: 1 }} />
{/* notification */}
<NotificationSection />
{/* profile */}
<ProfileSection />
</>
);
}
|