You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

578 lines
23 KiB

  1. import PropTypes from 'prop-types';
  2. import React
  3. , { useState }
  4. from 'react';
  5. import { useDispatch } from "react-redux";
  6. import { useNavigate } from "react-router-dom";
  7. // material-ui
  8. // import { useTheme } from '@mui/material/styles';
  9. import {
  10. AppBar,
  11. // Container,
  12. Typography,
  13. Box,
  14. Stack,
  15. // IconButton,
  16. // Menu,
  17. // MenuItem,
  18. // Button,
  19. // Tooltip,
  20. // Avatar,
  21. // Stack,
  22. Toolbar,
  23. Divider,
  24. // List,
  25. // ListItem,
  26. // ListItemButton,
  27. // ListItemText,
  28. IconButton,
  29. Drawer, Grid,
  30. // useMediaQuery
  31. } from '@mui/material';
  32. import MenuIcon from '@mui/icons-material/Menu';
  33. import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
  34. // project import
  35. // import AppBarStyled from './AppBarStyled';
  36. // import HeaderContent from './HeaderContent';
  37. import Logo from 'components/Logo';
  38. import AdminLogo from 'components/AdminLogo';
  39. import MobileLogo from 'components/MobileLogo';
  40. //import Profile from './HeaderContent/Profile';
  41. import "assets/style/navbarStyles.css";
  42. import {
  43. isUserLoggedIn,
  44. isGLDLoggedIn,
  45. isPrimaryLoggedIn,
  46. isCreditorLoggedIn,
  47. isINDLoggedIn,
  48. // isORGLoggedIn,
  49. // getUserId
  50. } from "utils/Utils";
  51. import { handleLogoutFunction } from 'auth/index';
  52. // assets
  53. // import { MenuFoldOutlined,MenuOutlined } from '@ant-design/icons';
  54. // import { AppBar } from '../../../../node_modules/@mui/material/index';
  55. import { Link } from "react-router-dom";
  56. import LocaleSelector from "./HeaderContent/LocaleSelector";
  57. import { FormattedMessage } from "react-intl";
  58. const drawerWidth = 300;
  59. // const navItems = ['Home', 'About', 'Contact'];
  60. // ==============================|| MAIN LAYOUT - HEADER ||============================== //
  61. function Header(props) {
  62. const { window } = props;
  63. const [mobileOpen, setMobileOpen] = useState(false);
  64. const dispatch = useDispatch()
  65. const navigate = useNavigate()
  66. const handleDrawerToggle = () => {
  67. setMobileOpen((prevState) => !prevState);
  68. };
  69. const handleLogout = async () => {
  70. dispatch(handleLogoutFunction());
  71. //await handleLogoutFunction();
  72. navigate('/login');
  73. };
  74. const loginContent = (
  75. isGLDLoggedIn() ?
  76. <div id="adminContent">
  77. <li>
  78. <Link className="dashboard" to='/dashboard'>
  79. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }} >
  80. Dashboard
  81. </Typography>
  82. </Link>
  83. </li>
  84. <li>
  85. <Link className="application" to='/application/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Application</Typography></Link>
  86. </li>
  87. <li>
  88. <Link className="proof" to='/proof/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Proof</Typography></Link>
  89. </li>
  90. <li>
  91. <Link className="paymentTop" ><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Payment</Typography><KeyboardArrowDownIcon sx={{ fontSize: '1.0rem' }} /></Link>
  92. <ul className='dropdown'>
  93. <li>
  94. <Link className="payment" to='/paymentPage/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Online Payment Record</Typography></Link>
  95. </li>
  96. <li>
  97. <Link className="downloadXML" to='/gfmis/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>GFMIS Generate XML</Typography></Link>
  98. </li>
  99. <li>
  100. <Link className="reconReport" to='/paymentPage/reconReport'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Recon Report</Typography></Link>
  101. </li>
  102. <li>
  103. <Link className="createDemandNote" to='/paymentPage/createDemandNote' ><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Create Demand Note</Typography></Link>
  104. </li>
  105. <li>
  106. <Link className="demandNote" to='/paymentPage/demandNote' ><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Demand Note</Typography></Link>
  107. </li>
  108. </ul>
  109. </li>
  110. <li>
  111. <Link className="client" ><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Client</Typography><KeyboardArrowDownIcon sx={{ fontSize: '1.0rem' }} /></Link>
  112. <ul className='dropdown'>
  113. <li>
  114. <Link className="userSearchview" to='/userSearchview'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Users (GLD)</Typography></Link>
  115. </li>
  116. <li>
  117. <Link className="indUser" to='/indUser'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Users (Individual)</Typography></Link>
  118. </li>
  119. <li>
  120. <Link className="orgUser" to='/orgUser'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Users (Organisation)</Typography></Link>
  121. </li>
  122. <li>
  123. <Link className="org" to='/org'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Organisation</Typography></Link>
  124. </li>
  125. <li>
  126. <Link className="usergroupSearchview" to='/usergroupSearchview'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>User Group</Typography></Link>
  127. </li>
  128. </ul>
  129. </li>
  130. <li>
  131. <Link className="setting" ><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Settings</Typography><KeyboardArrowDownIcon sx={{ fontSize: '1.0rem' }} /></Link>
  132. <ul className='dropdown'>
  133. <li>
  134. <Link className="userProfileGld" to='/user/profile'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>My Profile</Typography></Link>
  135. </li>
  136. <li>
  137. <Link className="holidaySetting" to='/setting/holiday'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Holiday Settings</Typography></Link>
  138. </li>
  139. <li>
  140. <Link className="gazetteissueSetting" to='/setting/gazetteissuepage'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Gazette Issues</Typography></Link>
  141. </li>
  142. <li>
  143. <Link className="announcement" to='/setting/announcement'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Announcement</Typography></Link>
  144. </li>
  145. <li>
  146. <Link className="emailTemplate" to='/setting/emailTemplate'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Email Template</Typography></Link>
  147. </li>
  148. <li>
  149. <Link className="drImport" to='/setting/drImport'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>DR Import</Typography></Link>
  150. </li>
  151. <li>
  152. <Link className="systemSetting" to='/setting/sys'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>System Settings</Typography></Link>
  153. </li>
  154. <li>
  155. <Link className="auditLogSetting" to='/setting/auditLog'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Audit Log</Typography></Link>
  156. </li>
  157. </ul>
  158. </li>
  159. <Box sx={{display: {xs: 'none', sm: 'none', md: 'block'}}}>
  160. <li>
  161. <Link className="logout" onClick={handleLogout}><Typography variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>Logout</Typography></Link>
  162. </li>
  163. </Box>
  164. </div>
  165. :
  166. <div id="individualUserContent">
  167. <li>
  168. <Link className="dashboard" to='/dashboard'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  169. <FormattedMessage id="mainPage" />
  170. </Typography></Link>
  171. </li>
  172. <li>
  173. <Link className="myDocumet" to='/publicNotice'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  174. <FormattedMessage id="myPublicNotice" />
  175. </Typography></Link>
  176. </li>
  177. <li>
  178. <Link className="documentRecord" to='/proof/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  179. <FormattedMessage id="proofRecord" />
  180. </Typography></Link>
  181. </li>
  182. <li>
  183. {isCreditorLoggedIn() ?
  184. <>
  185. <Link className="paymentRecord">
  186. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  187. <FormattedMessage id="paymentHistory"/>
  188. </Typography>
  189. <KeyboardArrowDownIcon sx={{ fontSize: '1.0rem' }} />
  190. </Link>
  191. <ul className='dropdown'>
  192. <li>
  193. <Link className="manageOrgUser" to='/paymentPage/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  194. <FormattedMessage id="onlinePaymentHistory" />
  195. </Typography></Link>
  196. </li>
  197. <li>
  198. <Link className="manageOrgUser" to='/paymentPage/demandNote'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  199. <FormattedMessage id="paymentInfoRecord" />
  200. </Typography></Link>
  201. </li>
  202. </ul>
  203. </>
  204. :
  205. <Link className="manageOrgUser" to='/paymentPage/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  206. <FormattedMessage id="onlinePaymentHistory" />
  207. </Typography></Link>
  208. }
  209. </li>
  210. <li>
  211. {isPrimaryLoggedIn() ?
  212. <>
  213. <Link className="userSetting" >
  214. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }} onClick={(event) => console.log(event)}>
  215. <FormattedMessage id="setting" />
  216. </Typography>
  217. <KeyboardArrowDownIcon sx={{ fontSize: '1.0rem' }} />
  218. </Link>
  219. <ul className='dropdown' style={{ width: "max-content" }}>
  220. <li>
  221. <Link className="manageOrgUser" to='setting/manageUser'>
  222. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  223. <FormattedMessage id="companyOrUserRecord" />
  224. </Typography>
  225. </Link>
  226. </li>
  227. <li>
  228. <Link className="manageUser" to={'/orgUser'}>
  229. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  230. {/* <FormattedMessage id="companyOrUserRecord" /> */}
  231. <FormattedMessage id="userProfile" />
  232. </Typography>
  233. </Link>
  234. </li>
  235. <li>
  236. <Link className="manageUser" to={'/org'}>
  237. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  238. {/* <FormattedMessage id="companyOrUserRecord" /> */}
  239. <FormattedMessage id="organizationProfile" />
  240. </Typography>
  241. </Link>
  242. </li>
  243. </ul>
  244. </>
  245. :
  246. isINDLoggedIn()?
  247. <>
  248. <Link className="userSetting" >
  249. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }} onClick={(event) => console.log(event)}>
  250. <FormattedMessage id="setting" />
  251. </Typography>
  252. <KeyboardArrowDownIcon sx={{ fontSize: '1.0rem' }} />
  253. </Link>
  254. <ul className='dropdown' style={{ width: "max-content" }}>
  255. <li>
  256. <Link className="manageUser" to={'/indUser'}>
  257. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  258. {/* <FormattedMessage id="companyOrUserRecord" /> */}
  259. <FormattedMessage id="userProfile" />
  260. </Typography>
  261. </Link>
  262. </li>
  263. </ul>
  264. </>
  265. :
  266. <>
  267. <Link className="userSetting" >
  268. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }} onClick={(event) => console.log(event)}>
  269. <FormattedMessage id="setting" />
  270. </Typography>
  271. <KeyboardArrowDownIcon sx={{ fontSize: '1.0rem' }} />
  272. </Link>
  273. <ul className='dropdown' style={{ width: "max-content" }}>
  274. <li>
  275. <Link className="manageUser" to={'/orgUser'}>
  276. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  277. <FormattedMessage id="userProfile" />
  278. </Typography>
  279. </Link>
  280. </li>
  281. </ul>
  282. </>
  283. }
  284. </li>
  285. <Box sx={{display: {xs: 'none', sm: 'none', md: 'block'}}}>
  286. <li>
  287. <Link className="logout" onClick={handleLogout}><Typography variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  288. <FormattedMessage id="logout" />
  289. </Typography></Link>
  290. </li>
  291. </Box>
  292. </div>
  293. );
  294. const logoutContent = (
  295. <div>
  296. <li>
  297. <Link className="login" to='/login'>
  298. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  299. <FormattedMessage id="login" />
  300. </Typography>
  301. </Link>
  302. </li>
  303. <li>
  304. <Link className="register" to='/register'>
  305. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  306. <FormattedMessage id="register" />
  307. </Typography>
  308. </Link>
  309. </li>
  310. </div>
  311. );
  312. const drawer = (
  313. isUserLoggedIn() ?
  314. <Stack id="sidebar" direction="column" justifyContent="center" alignItems="center" /*onClick={handleDrawerToggle}*/ sx={{ textAlign: 'center', width: '300px' }}>
  315. {/* <Typography variant="h6" sx={{ my: 2 }}>
  316. PNSPS
  317. </Typography> */}
  318. <Box sx={{ mr: 2, mt:1, display: { md: 'none' } }}>
  319. <MobileLogo />
  320. <span id="mobileTitle" >PNSPS</span>
  321. </Box>
  322. <Divider />
  323. <ul id="sidebartop">
  324. {loginContent}
  325. </ul>
  326. <Divider />
  327. <ul id="sidebarbottom">
  328. <li>
  329. <Link className="logout" onClick={handleLogout}>
  330. <FormattedMessage id="logout" />
  331. </Link>
  332. </li>
  333. </ul>
  334. </Stack>
  335. :
  336. <Stack id="sidebar" direction="column" justifyContent="center" alignItems="center" onClick={handleDrawerToggle} sx={{ textAlign: 'center' }}>
  337. <Box sx={{ mr: 2, mt:1, display: { md: 'none' } }}>
  338. <MobileLogo />
  339. <span id="mobileTitle" >PNSPS</span>
  340. </Box>
  341. <Divider />
  342. <ul id="logoutContent">
  343. {logoutContent}
  344. </ul>
  345. <Divider />
  346. </Stack>
  347. );
  348. const container = window !== undefined ? () => window().document.body : undefined;
  349. return (
  350. isUserLoggedIn() ?
  351. // User Login success
  352. <Box>
  353. <AppBar component="nav">
  354. <Toolbar id="nav" width="100%">
  355. {isGLDLoggedIn()
  356. ? <Stack
  357. direction="row"
  358. justifyContent="flex-start"
  359. alignItems="center"
  360. spacing={0}
  361. >
  362. <Box mt={0.5} sx={{ display: { xs: 'none', sm: 'none', md: 'block' } }}>
  363. <AdminLogo />
  364. </Box>
  365. <IconButton
  366. color="inherit"
  367. aria-label="open drawer"
  368. edge="start"
  369. onClick={handleDrawerToggle}
  370. sx={{ mr: 2, display: { md: 'none' } }}
  371. >
  372. <MenuIcon style={{ color: '#0C489E' }} />
  373. </IconButton>
  374. <Box sx={{ mr: 2, display: { md: 'none' } }}>
  375. <MobileLogo />
  376. <span id="mobileTitle" >PNSPS</span>
  377. </Box>
  378. </Stack> :
  379. <Stack
  380. direction="row"
  381. justifyContent="flex-start"
  382. alignItems="center"
  383. spacing={0}
  384. sx={{width:{xs:'100%',md:'25%'}}}
  385. >
  386. <Box sx={{ width: '260px', flexGrow: 1, display: { xs: 'none', sm: 'none', md: 'block' } }}>
  387. <Stack direction="row" justifyContent="flex-start" alignItems="center">
  388. <Logo />
  389. <Stack justifyContent="flex-start" alignItems="center">
  390. {/*<span id="systemTitle">公共啟事提交</span>*/}
  391. {/*<span id="systemTitle">及繳費系統</span>*/}
  392. <span id="systemTitle">
  393. <FormattedMessage id="PNSPS" />
  394. </span>
  395. </Stack>
  396. </Stack>
  397. </Box>
  398. <IconButton
  399. color="inherit"
  400. aria-label="open drawer"
  401. edge="start"
  402. onClick={handleDrawerToggle}
  403. sx={{ mr: 2, display: { md: 'none' } }}
  404. >
  405. <MenuIcon style={{ color: '#0C489E' }} />
  406. </IconButton>
  407. <Box sx={{ flexGrow: 1, mr: 2, display: { sm: 'block', md: 'none' } }}>
  408. <Stack direction="row" justifyContent="space-between" alignItems="center" width="100%">
  409. <MobileLogo />
  410. <Stack justifyContent="flex-start" alignItems="flex-start" width="100%" ml={2}>
  411. <span id="mobileTitle">
  412. <FormattedMessage id="PNSPS" />
  413. </span>
  414. </Stack>
  415. <Stack justifyContent="flex-end" alignItems="center">
  416. <LocaleSelector />
  417. </Stack>
  418. </Stack>
  419. </Box>
  420. </Stack>
  421. }
  422. <Box sx={{ display: { xs: 'none', sm: 'none', md: 'block' }, width: "100%" }}>
  423. <Stack
  424. direction="row"
  425. justifyContent="space-between"
  426. alignItems="center"
  427. spacing={1}
  428. >
  429. <ul id="navbar" width="100%" >
  430. {loginContent}
  431. </ul>
  432. <Grid item>
  433. <Grid container direction="column"
  434. justifyContent="flex-end"
  435. alignItems="center"
  436. >
  437. {
  438. isGLDLoggedIn() ?
  439. <Grid item />
  440. :
  441. <Grid item>
  442. <LocaleSelector />
  443. </Grid>
  444. }
  445. {/*<Profile />*/}
  446. </Grid>
  447. </Grid>
  448. </Stack>
  449. </Box>
  450. </Toolbar>
  451. </AppBar>
  452. <Box component="nav">
  453. <Drawer
  454. container={container}
  455. variant="temporary"
  456. open={mobileOpen}
  457. onClose={handleDrawerToggle}
  458. ModalProps={{
  459. keepMounted: true, // Better open performance on mobile.
  460. }}
  461. sx={{
  462. display: { sm: 'block', md: 'none' },
  463. '& .MuiDrawer-paper': { boxSizing: 'border-box', width: drawerWidth },
  464. }}
  465. >
  466. {drawer}
  467. </Drawer>
  468. </Box>
  469. </Box> :
  470. <Box>
  471. <AppBar component="nav">
  472. <Toolbar id="nav" width="100%">
  473. <Stack
  474. direction="row"
  475. justifyContent="flex-start"
  476. alignItems="center"
  477. spacing={0}
  478. // width="100%"
  479. sx={{width:{xs:'100%',md:'25%'}}}
  480. >
  481. <Box sx={{ flexGrow: 1, display: { xs: 'none', sm: 'none', md: 'block' } }}>
  482. <Stack direction="row" justifyContent="flex-start" alignItems="center" >
  483. <Logo />
  484. <Stack justifyContent="flex-start" alignItems="center">
  485. <span id="systemTitle">
  486. <FormattedMessage id="PNSPS" />
  487. </span>
  488. </Stack>
  489. </Stack>
  490. </Box>
  491. <IconButton
  492. color="inherit"
  493. aria-label="open drawer"
  494. edge="start"
  495. onClick={handleDrawerToggle}
  496. sx={{ mr: 2, display: { md: 'none' } }}
  497. >
  498. <MenuIcon style={{ color: '#0C489E' }} />
  499. </IconButton>
  500. <Box sx={{ flexGrow: 1, mr: 2, display: { sm: 'block', md: 'none' } }}>
  501. <Stack direction="row" justifyContent="space-between" alignItems="center" width="100%">
  502. <MobileLogo />
  503. <Stack justifyContent="flex-start" alignItems="flex-start" width="100%" ml={2}>
  504. <span id="mobileTitle">
  505. <FormattedMessage id="PNSPS" />
  506. </span>
  507. </Stack>
  508. <Stack justifyContent="flex-end" alignItems="center">
  509. <LocaleSelector />
  510. </Stack>
  511. </Stack>
  512. </Box>
  513. </Stack>
  514. <Box sx={{ display: { xs: 'none', sm: 'none', md: 'block' }, width: "75%" }}>
  515. <Stack
  516. direction="row"
  517. justifyContent="space-between"
  518. alignItems="center"
  519. spacing={1}
  520. >
  521. <ul id="navbar" width="100%" >
  522. {logoutContent}
  523. </ul>
  524. <LocaleSelector />
  525. {/*<Profile />*/}
  526. </Stack>
  527. </Box>
  528. </Toolbar>
  529. </AppBar>
  530. <Box component="nav">
  531. <Drawer
  532. container={container}
  533. variant="temporary"
  534. open={mobileOpen}
  535. onClose={handleDrawerToggle}
  536. ModalProps={{
  537. keepMounted: true, // Better open performance on mobile.
  538. }}
  539. sx={{
  540. display: { sm: 'block', md: 'none' },
  541. '& .MuiDrawer-paper': { boxSizing: 'border-box', width: drawerWidth },
  542. }}
  543. >
  544. {drawer}
  545. </Drawer>
  546. </Box>
  547. </Box>
  548. );
  549. }
  550. Header.propTypes = {
  551. /**
  552. * Injected by the documentation to work in an iframe.
  553. * You won't need it on your project.
  554. */
  555. window: PropTypes.func,
  556. };
  557. export default Header;