64 lines
1.4 KiB
JavaScript
64 lines
1.4 KiB
JavaScript
import Head from "next/head";
|
|
import Link from "next/link";
|
|
import { useState } from "react";
|
|
import {
|
|
Button,
|
|
Stack,
|
|
Box,
|
|
CssBaseline,
|
|
AppBar,
|
|
Toolbar,
|
|
Typography,
|
|
} from "@mui/material";
|
|
import "../styles/globals.css";
|
|
|
|
function MyApp({ Component, pageProps }) {
|
|
const [username, setUsername] = useState("");
|
|
pageProps = { ...pageProps, username, setUsername };
|
|
return (
|
|
<>
|
|
<Head>
|
|
<title>ITSC Tool</title>
|
|
<meta
|
|
name="viewport"
|
|
content="minimum-scale=1, initial-scale=1, width=device-width"
|
|
/>
|
|
<CssBaseline />
|
|
</Head>
|
|
<AppBar
|
|
position="static"
|
|
sx={{
|
|
mb: 3,
|
|
}}
|
|
>
|
|
<Toolbar
|
|
sx={{
|
|
flex: 1,
|
|
justifyContent: "space-between",
|
|
alignItems: "center",
|
|
}}
|
|
>
|
|
<Typography variant="h5">
|
|
<Link href="/">ITSC Tool</Link>
|
|
</Typography>
|
|
{username && (
|
|
<Button
|
|
variant="contained"
|
|
color="secondary"
|
|
onClick={() => {
|
|
//localStorage.removeItem("username");
|
|
setUsername("");
|
|
}}
|
|
>
|
|
{username} (Logout)
|
|
</Button>
|
|
)}
|
|
</Toolbar>
|
|
</AppBar>
|
|
<Component {...pageProps} />
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default MyApp;
|