EquipmentTracker-Frontend/src/Components/Header/Header.tsx

51 lines
1.2 KiB
TypeScript
Raw Normal View History

import { useState } from "react";
2023-11-17 17:23:53 +08:00
import styles, { colors } from "../../styles";
2023-11-19 14:50:39 +08:00
import MenuIcon from "@mui/icons-material/Menu";
import SidebarModal from "../Drawer/Drawer";
2023-11-19 14:50:39 +08:00
import { Drawer } from "@mui/material";
2023-11-17 17:23:53 +08:00
export interface props {
2023-11-19 16:10:36 +08:00
label: string;
2023-11-17 17:23:53 +08:00
}
export default function Header(props: props) {
2023-11-19 14:50:39 +08:00
const [SidebarOpen, SetSidebarOpen] = useState(false);
2023-11-17 17:23:53 +08:00
return (
<div
style={{
position: "sticky",
top: 0,
zIndex: -1,
backgroundColor: colors.header_color,
display: "flex",
2023-11-19 14:50:39 +08:00
flexDirection: "row",
2023-11-17 17:23:53 +08:00
}}
>
2023-11-19 14:50:39 +08:00
<div
style={{
flex: 1,
alignSelf: "center",
}}
>
<MenuIcon
style={{
height: "64px",
width: "64px",
float: "left",
marginLeft: "8px",
}}
onClick={() => {
SetSidebarOpen(true);
}}
/>
</div>
<p style={{ ...styles.text_light, ...styles.text_M, ...{ flex: 1 } }}>
{props.label}
</p>
<div style={{ flex: 1 }} />
<Drawer open={SidebarOpen} onClose={() => SetSidebarOpen(false)}>
<SidebarModal />
</Drawer>
2023-11-17 17:23:53 +08:00
</div>
);
}