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

83 lines
2.1 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-04-17 12:24:09 +00:00
import { authStore } from "@root/stores/auth";
2022-09-08 17:21:17 +00:00
2023-04-17 12:24:09 +00:00
const Header: React.FC = () => {
const { makeRequest } = authStore();
2022-09-08 17:21:17 +00:00
return (
<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={() => {
makeRequest({
2023-05-05 19:05:09 +00:00
url: "https://admin.pena.digital/auth/auth/logout",
2023-04-17 12:24:09 +00:00
contentType: true,
}).then(() => localStorage.setItem("AT", ""));
}}
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;