improve this component to add SignInButton and signOut inside the Hamburger Menu (three lines) #146764
Unanswered
karabubi
asked this question in
Code Search and Navigation
Replies: 1 comment
-
Ehy man if you need this kind of help you should open an issue ang give like a label as "first good issue" then try to wait or ask for help of the issue! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Select Topic Area
Question
Body
import * as React from "react";
import { useUser, useClerk } from "@clerk/clerk-react";
import { SignInButton, UserButton } from "@clerk/clerk-react";
import { Link, useNavigate } from "react-router-dom";
import AppBar from "@mui/material/AppBar";
import Box from "@mui/material/Box";
import Toolbar from "@mui/material/Toolbar";
import IconButton from "@mui/material/IconButton";
import Typography from "@mui/material/Typography";
import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem";
import MenuIcon from "@mui/icons-material/Menu";
import Container from "@mui/material/Container";
import Avatar from "@mui/material/Avatar";
import Tooltip from "@mui/material/Tooltip";
import "./NavBar.css";
const NavBar = () => {
const { isSignedIn } = useUser();
const { signOut } = useClerk();
const navigate = useNavigate();
const handleLogout = async () => {
await signOut();
navigate("/");
};
const [anchorElNav, setAnchorElNav] = React.useState(null);
const [anchorElUser, setAnchorElUser] = React.useState(null);
const handleOpenNavMenu = (event) => {
setAnchorElNav(event.currentTarget);
};
const handleOpenUserMenu = (event) => {
setAnchorElUser(event.currentTarget);
};
const handleCloseNavMenu = () => {
setAnchorElNav(null);
};
const handleCloseUserMenu = () => {
setAnchorElUser(null);
};
return (
<Box sx={{ flexGrow: 1, display: { xs: "flex", md: "none" } }}>
<Menu
id="menu-appbar"
anchorEl={anchorElNav}
anchorOrigin={{
vertical: "bottom",
horizontal: "left",
}}
transformOrigin={{
vertical: "top",
horizontal: "left",
}}
open={Boolean(anchorElNav)}
onClose={handleCloseNavMenu}
>
<Typography sx={{ textAlign: "center" }}>Home
{isSignedIn && [
<Typography sx={{ textAlign: "center" }}>
Route Dashboard
,
<Typography sx={{ textAlign: "center" }}>
Addresses
,
<Typography sx={{ textAlign: "center" }}>
Delivery Management
,
<Typography sx={{ textAlign: "center" }}>
Big Map View
,
]}
);
};
export default NavBar;
Beta Was this translation helpful? Give feedback.
All reactions