From 5c7e1df051c86914a7358aa52dc159e1d6bd3470 Mon Sep 17 00:00:00 2001 From: Leandro Farias Date: Thu, 23 Mar 2023 13:09:04 +0000 Subject: [PATCH 1/2] fix: mobile nav open --- frontend/src/layouts/dashboard/layout.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/frontend/src/layouts/dashboard/layout.js b/frontend/src/layouts/dashboard/layout.js index 72f7885..e480f5d 100644 --- a/frontend/src/layouts/dashboard/layout.js +++ b/frontend/src/layouts/dashboard/layout.js @@ -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 { withAuthGuard } from 'src/hocs/with-auth-guard'; import { SideNav } from './side-nav'; import { TopNav } from './top-nav'; -import { usePathname } from 'next/navigation'; const SIDE_NAV_WIDTH = 280; @@ -26,15 +26,23 @@ const LayoutContainer = styled('div')({ export const Layout = withAuthGuard((props) => { const { children } = props; const pathname = usePathname(); - const [openNav, setOpenNav] = useState(true); + const [openNav, setOpenNav] = useState(false); - useEffect( + const handlePathnameChange = useCallback( () => { if (openNav) { setOpenNav(false); } }, - [pathname, openNav] + [openNav] + ); + + useEffect( + () => { + handlePathnameChange(); + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [pathname] ); return ( @@ -51,4 +59,4 @@ export const Layout = withAuthGuard((props) => { ); -}); +}); \ No newline at end of file From 99657ed40fbf87af4e370d02721b9f69b330b961 Mon Sep 17 00:00:00 2001 From: Leandro Farias Date: Thu, 23 Mar 2023 13:09:27 +0000 Subject: [PATCH 2/2] chore: remove live preview card --- frontend/src/layouts/dashboard/side-nav.js | 50 ---------------------- 1 file changed, 50 deletions(-) diff --git a/frontend/src/layouts/dashboard/side-nav.js b/frontend/src/layouts/dashboard/side-nav.js index a50ba61..86008c0 100644 --- a/frontend/src/layouts/dashboard/side-nav.js +++ b/frontend/src/layouts/dashboard/side-nav.js @@ -124,56 +124,6 @@ export const SideNav = (props) => { - - - Need more features? - - - Check out our Pro solution template. - - - Go to pro - - - );