Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Leandro Antônio Farias Machado 2023-03-28 11:49:40 -03:00
commit 1c74ad372c
2 changed files with 14 additions and 56 deletions

View File

@ -1,9 +1,9 @@
import { useEffect, useState } from 'react'; import { useCallback, useEffect, useState } from 'react';
import { usePathname } from 'next/navigation';
import { styled } from '@mui/material/styles'; import { styled } from '@mui/material/styles';
import { withAuthGuard } from 'src/hocs/with-auth-guard'; import { withAuthGuard } from 'src/hocs/with-auth-guard';
import { SideNav } from './side-nav'; import { SideNav } from './side-nav';
import { TopNav } from './top-nav'; import { TopNav } from './top-nav';
import { usePathname } from 'next/navigation';
const SIDE_NAV_WIDTH = 280; const SIDE_NAV_WIDTH = 280;
@ -26,15 +26,23 @@ const LayoutContainer = styled('div')({
export const Layout = withAuthGuard((props) => { export const Layout = withAuthGuard((props) => {
const { children } = props; const { children } = props;
const pathname = usePathname(); const pathname = usePathname();
const [openNav, setOpenNav] = useState(true); const [openNav, setOpenNav] = useState(false);
useEffect( const handlePathnameChange = useCallback(
() => { () => {
if (openNav) { if (openNav) {
setOpenNav(false); setOpenNav(false);
} }
}, },
[pathname, openNav] [openNav]
);
useEffect(
() => {
handlePathnameChange();
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[pathname]
); );
return ( return (
@ -51,4 +59,4 @@ export const Layout = withAuthGuard((props) => {
</LayoutRoot> </LayoutRoot>
</> </>
); );
}); });

View File

@ -124,56 +124,6 @@ export const SideNav = (props) => {
</Stack> </Stack>
</Box> </Box>
<Divider sx={{ borderColor: 'neutral.700' }} /> <Divider sx={{ borderColor: 'neutral.700' }} />
<Box
sx={{
px: 2,
py: 3
}}
>
<Typography
color="neutral.100"
variant="subtitle2"
>
Need more features?
</Typography>
<Typography
color="neutral.500"
variant="body2"
>
Check out our Pro solution template.
</Typography>
<Box
sx={{
display: 'flex',
mt: 2,
mx: 'auto',
width: '160px',
'& img': {
width: '100%'
}
}}
>
<img
alt="Go to pro"
src="/assets/devias-kit-pro.png"
/>
</Box>
<Button
component="a"
endIcon={(
<SvgIcon fontSize="small">
<ArrowTopRightOnSquareIcon />
</SvgIcon>
)}
fullWidth
href="https://material-kit-pro-react.devias.io/"
sx={{ mt: 2 }}
target="_blank"
variant="contained"
>
Pro Live Preview
</Button>
</Box>
</Box> </Box>
</Scrollbar> </Scrollbar>
); );