adminFront/src/pages/dashboard/Header/index.tsx

80 lines
2.0 KiB
TypeScript
Raw Normal View History

2022-09-08 17:21:17 +00:00
import * as React from "react";
2023-04-17 12:24:09 +00:00
import { Box, IconButton, Typography } from "@mui/material";
2022-09-20 14:35:49 +00:00
import theme from "../../../theme";
2023-04-17 12:24:09 +00:00
import ExitToAppOutlinedIcon from "@mui/icons-material/ExitToAppOutlined";
2022-09-20 14:35:49 +00:00
import Logo from "../../Logo";
2023-09-01 13:17:24 +00:00
import { clearAuthToken } from "@frontend/kitui";
import { logout } from "@root/api/auth";
2022-09-08 17:21:17 +00:00
2023-04-17 12:24:09 +00:00
const Header: React.FC = () => {
2023-09-01 13:17:24 +00:00
return (
2022-09-08 17:21:17 +00:00
<React.Fragment>
2023-04-17 12:24:09 +00:00
<Box
sx={{
backgroundColor: theme.palette.menu.main,
width: "100%",
minHeight: "85px",
2022-09-08 17:21:17 +00:00
display: "flex",
2023-04-17 12:24:09 +00:00
justifyContent: "space-between",
flexWrap: "wrap",
paddingLeft: "5px",
}}
>
<Box
sx={{
width: "150px",
display: "flex",
justifyContent: "right",
alignItems: "center",
}}
>
2022-09-08 17:21:17 +00:00
<Logo />
</Box>
2023-04-17 12:24:09 +00:00
<Box
sx={{
display: "flex",
}}
>
<Typography
2022-09-08 17:21:17 +00:00
variant="h6"
sx={{
maxWidth: "230px",
2022-09-08 17:21:17 +00:00
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
2023-04-17 12:24:09 +00:00
fontWeight: "normal",
2022-09-08 17:21:17 +00:00
}}
>
2023-04-17 12:24:09 +00:00
Добро пожаловать, Администратор сервиса
2022-09-08 17:21:17 +00:00
</Typography>
<IconButton
2023-04-17 12:24:09 +00:00
onClick={() => {
2023-09-01 13:17:24 +00:00
logout().then(clearAuthToken);
2023-04-17 12:24:09 +00:00
}}
sx={{
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
cursor: "pointer",
padding: "0 31px",
}}
>
<ExitToAppOutlinedIcon
sx={{
color: theme.palette.golden.main,
transform: "scale(1.3)",
}}
2023-04-17 12:24:09 +00:00
/>
</IconButton>
2022-09-08 17:21:17 +00:00
</Box>
</Box>
</React.Fragment>
);
2023-04-17 12:24:09 +00:00
};
2022-09-08 17:21:17 +00:00
2023-04-17 12:24:09 +00:00
export default Header;