import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';
// @mui
import { styled, useTheme } from '@mui/material/styles';
import { Box, Stack, Drawer, Typography } from '@mui/material';
// hooks
import useResponsive from '../../../hooks/useResponsive';
import useCollapseDrawer from '../../../hooks/useCollapseDrawer';
// utils
import cssStyles from '../../../utils/cssStyles';
// config
import { NAVBAR } from '../../../config';
// components
import Logo from '../../../components/Logo';
import Scrollbar from '../../../components/Scrollbar';
import { NavSectionVertical } from '../../../components/nav-section';
//
import navConfig from './NavConfig';
import NavbarAccount from './NavbarAccount';
import CollapseButton from './CollapseButton';
// ----------------------------------------------------------------------
const RootStyle = styled('div')(({ theme }) => ({
[theme.breakpoints.up('lg')]: {
flexShrink: 0,
transition: theme.transitions.create('width', {
duration: theme.transitions.duration.shorter,
}),
},
}));
// ----------------------------------------------------------------------
type Props = {
isOpenSidebar: boolean;
onCloseSidebar: VoidFunction;
};
export default function NavbarVertical({ isOpenSidebar, onCloseSidebar }: Props) {
const theme = useTheme();
const { pathname } = useLocation();
const isDesktop = useResponsive('up', 'lg');
const { isCollapse, collapseClick, collapseHover, onToggleCollapse, onHoverEnter, onHoverLeave } =
useCollapseDrawer();
useEffect(() => {
if (isOpenSidebar) {
onCloseSidebar();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [pathname]);
const renderContent = (
{isDesktop && !isCollapse ? (
Client Portal
) : (
)}
);
return (
{!isDesktop && (
{renderContent}
)}
{isDesktop && (
theme.transitions.create('width', {
duration: theme.transitions.duration.standard,
}),
...(isCollapse && {
width: NAVBAR.DASHBOARD_COLLAPSE_WIDTH,
}),
...(collapseHover && {
...cssStyles(theme).bgBlur(),
boxShadow: (theme) => theme.customShadows.z24,
}),
},
}}
>
{renderContent}
)}
);
}