Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | import { Divider, IconButton, popoverClasses, styled } from "@mui/material"; import { MenuIcon, SinglePersonIcon } from "components/Icons"; import Menu, { MenuItem } from "components/Menu"; import { GLOBAL } from "i18n/namespaces"; import Link from "next/link"; import { useTranslation } from "next-i18next"; import React, { Dispatch, SetStateAction } from "react"; import { helpCenterURL, loginRoute, signupRoute } from "routes"; import { theme } from "theme"; import ReportButton from "./ReportButton"; const StyledIconButton = styled(IconButton)({ display: "flex", flexDirection: "row", alignItems: "center", border: `1px solid ${theme.palette.grey[300]}`, borderRadius: 999, backgroundColor: theme.palette.grey[200], padding: theme.spacing(1), transition: `${theme.transitions.duration.short}ms ${theme.transitions.easing.easeInOut}`, "&:hover": { opacity: 0.8, backgroundColor: theme.palette.grey[300], }, }); export default function GuestMenu({ menuOpen, setMenuOpen, }: { menuOpen: boolean; setMenuOpen: Dispatch<SetStateAction<boolean>>; }) { const menuRef = React.useRef<HTMLButtonElement>(null); const { t } = useTranslation(GLOBAL); return ( <> <StyledIconButton aria-controls="navigation-menu" aria-haspopup="true" onClick={() => setMenuOpen((prevMenuOpen: boolean) => !prevMenuOpen)} ref={menuRef} > <MenuIcon sx={{ fontSize: 18 }} /> <SinglePersonIcon sx={{ fontSize: 24, marginLeft: theme.spacing(1) }} /> </StyledIconButton> <Menu id="navigation-menu" open={menuOpen} anchorEl={menuRef.current} onClose={() => setMenuOpen(false)} anchorOrigin={{ vertical: "bottom", horizontal: "right", }} sx={{ boxShadow: theme.shadows[1], minWidth: "12rem", [`&.${popoverClasses.root}`]: { transform: "translateY(1rem)", }, }} > <MenuItem> <Link href={signupRoute} legacyBehavior> {t("sign_up")} </Link> </MenuItem> <MenuItem> <Link href={loginRoute} legacyBehavior> {t("login")} </Link> </MenuItem> <Divider /> <MenuItem> <ReportButton isMenuLink /> </MenuItem> <Divider /> <MenuItem> <Link href={helpCenterURL} target="_blank" legacyBehavior> {t("nav.help")} </Link> </MenuItem> </Menu> </> ); } |