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.5 KB
|
Line | |
---|
1 | // @mui
|
---|
2 | import Box, { BoxProps } from '@mui/material/Box';
|
---|
3 | // hooks
|
---|
4 | import { useResponsive } from 'src/hooks/use-responsive';
|
---|
5 | // components
|
---|
6 | import { useSettingsContext } from 'src/components/settings';
|
---|
7 | //
|
---|
8 | import { HEADER, NAV } from '../config-layout';
|
---|
9 |
|
---|
10 | // ----------------------------------------------------------------------
|
---|
11 |
|
---|
12 | const SPACING = 8;
|
---|
13 |
|
---|
14 | export default function Main({ children, sx, ...other }: BoxProps) {
|
---|
15 | const settings = useSettingsContext();
|
---|
16 |
|
---|
17 | const lgUp = useResponsive('up', 'lg');
|
---|
18 |
|
---|
19 | const isNavHorizontal = settings.themeLayout === 'horizontal';
|
---|
20 |
|
---|
21 | const isNavMini = settings.themeLayout === 'mini';
|
---|
22 |
|
---|
23 | if (isNavHorizontal) {
|
---|
24 | return (
|
---|
25 | <Box
|
---|
26 | component="main"
|
---|
27 | sx={{
|
---|
28 | minHeight: 1,
|
---|
29 | display: 'flex',
|
---|
30 | flexDirection: 'column',
|
---|
31 | pt: `${HEADER.H_MOBILE + 24}px`,
|
---|
32 | pb: 10,
|
---|
33 | ...(lgUp && {
|
---|
34 | pt: `${HEADER.H_MOBILE * 2 + 40}px`,
|
---|
35 | pb: 15,
|
---|
36 | }),
|
---|
37 | }}
|
---|
38 | >
|
---|
39 | {children}
|
---|
40 | </Box>
|
---|
41 | );
|
---|
42 | }
|
---|
43 |
|
---|
44 | return (
|
---|
45 | <Box
|
---|
46 | component="main"
|
---|
47 | sx={{
|
---|
48 | flexGrow: 1,
|
---|
49 | minHeight: 1,
|
---|
50 | display: 'flex',
|
---|
51 | flexDirection: 'column',
|
---|
52 | py: `${HEADER.H_MOBILE + SPACING}px`,
|
---|
53 | ...(lgUp && {
|
---|
54 | px: 2,
|
---|
55 | py: `${HEADER.H_DESKTOP + SPACING}px`,
|
---|
56 | width: `calc(100% - ${NAV.W_VERTICAL}px)`,
|
---|
57 | ...(isNavMini && {
|
---|
58 | width: `calc(100% - ${NAV.W_MINI}px)`,
|
---|
59 | }),
|
---|
60 | }),
|
---|
61 | ...sx,
|
---|
62 | }}
|
---|
63 | {...other}
|
---|
64 | >
|
---|
65 | {children}
|
---|
66 | </Box>
|
---|
67 | );
|
---|
68 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.