mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-09 18:26:40 +00:00
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import React from "react";
|
|
import { createStyles, makeStyles, Theme } from "@material-ui/core/styles";
|
|
import AppBar from "@material-ui/core/AppBar";
|
|
import Toolbar from "@material-ui/core/Toolbar";
|
|
import Typography from "@material-ui/core/Typography";
|
|
import Button from "@material-ui/core/Button";
|
|
import IconButton from "@material-ui/core/IconButton";
|
|
import MenuIcon from "@material-ui/icons/Menu";
|
|
import { useAuth0 } from "../authentication/auth0";
|
|
|
|
const useStyles = makeStyles((theme: Theme) =>
|
|
createStyles({
|
|
root: {
|
|
flexGrow: 1
|
|
},
|
|
menuButton: {
|
|
marginRight: theme.spacing(2)
|
|
},
|
|
title: {
|
|
flexGrow: 1
|
|
}
|
|
})
|
|
);
|
|
|
|
export default function ButtonAppBar() {
|
|
const classes = useStyles();
|
|
const { isAuthenticated, loginWithRedirect, logout } = useAuth0();
|
|
|
|
return (
|
|
<div className={classes.root}>
|
|
<AppBar position="static">
|
|
<Toolbar>
|
|
<IconButton
|
|
edge="start"
|
|
className={classes.menuButton}
|
|
color="inherit"
|
|
aria-label="menu"
|
|
>
|
|
<MenuIcon />
|
|
</IconButton>
|
|
<Typography variant="h6" className={classes.title}>
|
|
<Button color="inherit" href="/">
|
|
BugBuster
|
|
</Button>
|
|
</Typography>
|
|
{!isAuthenticated ? (
|
|
<Button color="inherit" onClick={() => loginWithRedirect({})}>
|
|
Log in
|
|
</Button>
|
|
) : (
|
|
<Button color="inherit" onClick={() => logout()}>
|
|
Log out
|
|
</Button>
|
|
)}
|
|
</Toolbar>
|
|
</AppBar>
|
|
</div>
|
|
);
|
|
}
|