11import PropTypes from 'prop-types' ;
22import { Icon } from '@iconify/react' ;
33import { useLocation } from 'react-router-dom' ;
4+ import { useSelector } from 'react-redux' ;
45
56// material-ui
67import { useTheme } from '@mui/material/styles' ;
@@ -12,6 +13,7 @@ import Profile from './Profile';
1213import ThemeButton from 'ui-component/ThemeButton' ;
1314import I18nButton from 'ui-component/i18nButton' ;
1415import { NoticeButton } from 'ui-component/notice' ;
16+ import { drawerWidth , miniDrawerWidth } from 'store/constant' ;
1517
1618// ==============================|| MAIN NAVBAR / HEADER ||============================== //
1719
@@ -20,20 +22,36 @@ const Header = ({ handleLeftDrawerToggle, toggleProfileDrawer }) => {
2022 const matchUpMd = useMediaQuery ( theme . breakpoints . up ( 'md' ) ) ;
2123 const location = useLocation ( ) ;
2224 const isConsoleRoute = location . pathname . startsWith ( '/panel' ) ;
25+ const leftDrawerOpened = useSelector ( ( state ) => state . customization . opened ) ;
2326
2427 return (
2528 < >
2629 < Box
2730 sx = { {
2831 display : 'flex' ,
2932 alignItems : 'center' ,
33+ ...( matchUpMd && {
34+ width : `${ leftDrawerOpened ? drawerWidth : miniDrawerWidth } px` ,
35+ ml : leftDrawerOpened ? 0 : - 3 ,
36+ transition : 'width 200ms cubic-bezier(0.4, 0, 0.2, 1), margin 200ms cubic-bezier(0.4, 0, 0.2, 1)'
37+ } ) ,
3038 [ theme . breakpoints . down ( 'md' ) ] : {
3139 width : 'auto'
3240 }
3341 } }
3442 >
35- < Box component = "span" sx = { { display : { xs : 'none' , md : 'block' } , mr : 1 } } >
36- < LogoSection />
43+ < Box
44+ component = "span"
45+ sx = { {
46+ display : { xs : 'none' , md : 'flex' } ,
47+ alignItems : 'center' ,
48+ justifyContent : leftDrawerOpened ? 'flex-start' : 'center' ,
49+ width : '100%' ,
50+ overflow : 'visible' ,
51+ transition : 'all 200ms cubic-bezier(0.4, 0, 0.2, 1)'
52+ } }
53+ >
54+ < LogoSection isMini = { ! leftDrawerOpened } />
3755 </ Box >
3856 { ! matchUpMd && (
3957 < IconButton
0 commit comments