source: src/layouts/dashboard/layout.tsx@ 5d6f37a

main
Last change on this file since 5d6f37a was 5d6f37a, checked in by Naum Shapkarovski <naumshapkarovski@…>, 7 weeks ago

add customer

  • Property mode set to 100644
File size: 1.8 KB
Line 
1// @mui
2import Box from '@mui/material/Box';
3// hooks
4import { useBoolean } from 'src/hooks/use-boolean';
5import { useResponsive } from 'src/hooks/use-responsive';
6// components
7import { useSettingsContext } from 'src/components/settings';
8//
9import Main from './main';
10import Header from './header';
11import NavMini from './nav-mini';
12import NavVertical from './nav-vertical';
13import NavHorizontal from './nav-horizontal';
14
15// ----------------------------------------------------------------------
16
17type Props = {
18 children: React.ReactNode;
19};
20
21export default function DashboardLayout({ children }: Props) {
22 const settings = useSettingsContext();
23
24 const lgUp = useResponsive('up', 'lg');
25
26 const nav = useBoolean();
27
28 const isHorizontal = settings.themeLayout === 'horizontal';
29
30 const isMini = settings.themeLayout === 'mini';
31
32 const renderNavMini = <NavMini />;
33
34 const renderHorizontal = <NavHorizontal />;
35
36 const renderNavVertical = <NavVertical openNav={nav.value} onCloseNav={nav.onFalse} />;
37
38 if (isHorizontal) {
39 return (
40 <>
41 <Header onOpenNav={nav.onTrue} />
42
43 {lgUp ? renderHorizontal : renderNavVertical}
44
45 <Main>{children}</Main>
46 </>
47 );
48 }
49
50 if (isMini) {
51 return (
52 <>
53 <Header onOpenNav={nav.onTrue} />
54
55 <Box
56 sx={{
57 minHeight: 1,
58 display: 'flex',
59 flexDirection: { xs: 'column', lg: 'row' },
60 }}
61 >
62 {lgUp ? renderNavMini : renderNavVertical}
63
64 <Main>{children}</Main>
65 </Box>
66 </>
67 );
68 }
69
70 return (
71 <>
72 <Header onOpenNav={nav.onTrue} />
73
74 <Box
75 sx={{
76 minHeight: 1,
77 display: 'flex',
78 flexDirection: { xs: 'column', lg: 'row' },
79 }}
80 >
81 {renderNavVertical}
82
83 <Main>{children}</Main>
84 </Box>
85 </>
86 );
87}
Note: See TracBrowser for help on using the repository browser.