feat(dashboard): update NavMobile component to use onToggle for menu button and adjust layout styles for responsiveness

This commit is contained in:
OlgunR
2025-12-10 15:23:13 +01:00
parent a01bde914a
commit a2673216c9
2 changed files with 17 additions and 6 deletions

View File

@@ -49,7 +49,7 @@ export function DashboardLayout({
}: DashboardLayoutProps) { }: DashboardLayoutProps) {
const theme = useTheme(); const theme = useTheme();
const { value: open, onFalse: onClose, onTrue: onOpen } = useBoolean(); const { value: open, onFalse: onClose, onToggle } = useBoolean();
const renderHeader = () => { const renderHeader = () => {
const headerSlotProps: HeaderSectionProps['slotProps'] = { const headerSlotProps: HeaderSectionProps['slotProps'] = {
@@ -96,11 +96,14 @@ export function DashboardLayout({
leftArea: ( leftArea: (
<> <>
{/** @slot Nav mobile */} {/** @slot Nav mobile */}
<MenuButton <MenuButton onClick={onToggle} sx={{ mr: 1, ml: -1 }} />
onClick={onOpen} <NavMobile
sx={{ mr: 1, ml: -1, [theme.breakpoints.up(layoutQuery)]: { display: 'none' } }} data={navData}
open={open}
onClose={onClose}
workspaces={_workspaces}
layoutQuery={layoutQuery}
/> />
<NavMobile data={navData} open={open} onClose={onClose} workspaces={_workspaces} />
</> </>
), ),
rightArea: ( rightArea: (

View File

@@ -78,8 +78,10 @@ export function NavMobile({
slots, slots,
onClose, onClose,
workspaces, workspaces,
}: NavContentProps & { open: boolean; onClose: () => void }) { layoutQuery,
}: NavContentProps & { open: boolean; onClose: () => void; layoutQuery: Breakpoint }) {
const pathname = usePathname(); const pathname = usePathname();
const theme = useTheme();
useEffect(() => { useEffect(() => {
if (open) { if (open) {
@@ -96,10 +98,16 @@ export function NavMobile({
[`& .${drawerClasses.paper}`]: { [`& .${drawerClasses.paper}`]: {
pt: 2.5, pt: 2.5,
px: 2.5, px: 2.5,
top: 'var(--layout-header-mobile-height)',
overflow: 'unset', overflow: 'unset',
height: 'calc(100% - var(--layout-header-mobile-height))',
width: 'var(--layout-nav-mobile-width)', width: 'var(--layout-nav-mobile-width)',
bgcolor: '#ffe8ed', bgcolor: '#ffe8ed',
color: '#4a0f14', color: '#4a0f14',
[theme.breakpoints.up(layoutQuery)]: {
top: 'var(--layout-header-desktop-height)',
height: 'calc(100% - var(--layout-header-desktop-height))',
},
...sx, ...sx,
}, },
}} }}