This repository has no description
1.0 kB
41 lines
1'use client';
2
3import { AppShell } from '@mantine/core';
4import { useNavbarContext } from '@/providers/navbar';
5import { usePathname } from 'next/navigation';
6import GuestNavbar from '../guestNavbar/GuestNavbar';
7
8interface Props {
9 children: React.ReactNode;
10}
11
12export default function GuestAppLayout(props: Props) {
13 const { mobileOpened, desktopOpened } = useNavbarContext();
14 const pathname = usePathname();
15
16 const ROUTES_WITH_ASIDE = ['/url'];
17 const hasAside = ROUTES_WITH_ASIDE.some((prefix) =>
18 pathname.startsWith(prefix),
19 );
20 const asideWidth = hasAside ? 300 : 0;
21
22 return (
23 <AppShell
24 header={{ height: 0 }}
25 navbar={{
26 width: 300,
27 breakpoint: 'xs',
28 collapsed: { mobile: !mobileOpened, desktop: !desktopOpened },
29 }}
30 aside={{
31 width: asideWidth,
32 breakpoint: 'xl',
33 collapsed: { mobile: true },
34 }}
35 >
36 <GuestNavbar />
37
38 <AppShell.Main>{props.children}</AppShell.Main>
39 </AppShell>
40 );
41}