source: src/layouts/dashboard/header.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: 2.7 KB
Line 
1// @mui
2import { useTheme } from '@mui/material/styles';
3import Stack from '@mui/material/Stack';
4import AppBar from '@mui/material/AppBar';
5import Toolbar from '@mui/material/Toolbar';
6import IconButton from '@mui/material/IconButton';
7// theme
8import { bgBlur } from 'src/theme/css';
9// hooks
10import { useOffSetTop } from 'src/hooks/use-off-set-top';
11import { useResponsive } from 'src/hooks/use-responsive';
12// components
13import Logo from 'src/components/logo';
14import SvgColor from 'src/components/svg-color';
15import { useSettingsContext } from 'src/components/settings';
16//
17import { HEADER, NAV } from '../config-layout';
18import { Searchbar, AccountPopover, SettingsButton } from '../_common';
19
20// ----------------------------------------------------------------------
21
22type Props = {
23 onOpenNav?: VoidFunction;
24};
25
26export default function Header({ onOpenNav }: Props) {
27 const theme = useTheme();
28
29 const settings = useSettingsContext();
30
31 const isNavHorizontal = settings.themeLayout === 'horizontal';
32
33 const isNavMini = settings.themeLayout === 'mini';
34
35 const lgUp = useResponsive('up', 'lg');
36
37 const offset = useOffSetTop(HEADER.H_DESKTOP);
38
39 const offsetTop = offset && !isNavHorizontal;
40
41 const renderContent = (
42 <>
43 {lgUp && isNavHorizontal && <Logo sx={{ mr: 2.5 }} />}
44
45 {!lgUp && (
46 <IconButton onClick={onOpenNav}>
47 <SvgColor src="/assets/icons/navbar/ic_menu_item.svg" />
48 </IconButton>
49 )}
50
51 <Searchbar />
52
53 <Stack
54 flexGrow={1}
55 direction="row"
56 alignItems="center"
57 justifyContent="flex-end"
58 spacing={{ xs: 0.5, sm: 1 }}
59 >
60 <SettingsButton />
61
62 <AccountPopover />
63 </Stack>
64 </>
65 );
66
67 return (
68 <AppBar
69 sx={{
70 height: HEADER.H_MOBILE,
71 zIndex: theme.zIndex.appBar + 1,
72 ...bgBlur({
73 color: theme.palette.background.default,
74 }),
75 transition: theme.transitions.create(['height'], {
76 duration: theme.transitions.duration.shorter,
77 }),
78 ...(lgUp && {
79 width: `calc(100% - ${NAV.W_VERTICAL + 1}px)`,
80 height: HEADER.H_DESKTOP,
81 ...(offsetTop && {
82 height: HEADER.H_DESKTOP_OFFSET,
83 }),
84 ...(isNavHorizontal && {
85 width: 1,
86 bgcolor: 'background.default',
87 height: HEADER.H_DESKTOP_OFFSET,
88 borderBottom: `dashed 1px ${theme.palette.divider}`,
89 }),
90 ...(isNavMini && {
91 width: `calc(100% - ${NAV.W_MINI + 1}px)`,
92 }),
93 }),
94 }}
95 >
96 <Toolbar
97 sx={{
98 height: 1,
99 px: { lg: 5 },
100 }}
101 >
102 {renderContent}
103 </Toolbar>
104 </AppBar>
105 );
106}
Note: See TracBrowser for help on using the repository browser.