-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAppHeader.tsx
87 lines (84 loc) · 1.94 KB
/
AppHeader.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { AppBar, Box, Toolbar, Typography } from "@mui/material";
import { AppHeaderProps } from "./AppHeader.types";
import IpgLogo from "../SvgIcons/IpgLogo";
import React from "react";
import UserMenu from "../UserMenu";
// appbar component
function AppHeader({
appLogo,
appName,
mode = "light",
onChangePassword,
onLogout,
username,
children
}: AppHeaderProps) {
return (
<AppBar
sx={theme => ({
backgroundColor: theme.palette.primary.main
})}
>
<Toolbar style={{ justifyContent: "space-between" }}>
<Box
sx={{
alignItems: "center",
display: "flex"
}}
>
<IpgLogo
textColour={mode === "light" ? "white" : "black"}
sx={{
height: 33,
width: 119
}}
/>
</Box>
<Box
sx={{
alignItems: "center",
display: "flex"
}}
>
{appLogo ? (
<span>{appLogo}</span>
) : (
<Typography
variant="h6"
sx={[
{
fontSize: "20px",
fontWeight: "600",
letterSpacing: "0.05em",
lineHeight: "34px"
},
theme => ({
color: "white",
...theme.applyStyles("dark", {
color: "#003063"
})
})
]}
>
<span>{appName}</span>
</Typography>
)}
</Box>
<Box
sx={{
alignItems: "center",
display: "flex"
}}
>
{children}
<UserMenu
username={username}
onChangePassword={onChangePassword}
onLogout={onLogout}
/>
</Box>
</Toolbar>
</AppBar>
);
}
export default AppHeader;