Move packages/apps back
This commit is contained in:
parent
6eaaf8e9be
commit
5535d6b575
348 changed files with 0 additions and 0 deletions
53
apps/leafcutter/components/AccountButton.tsx
Normal file
53
apps/leafcutter/components/AccountButton.tsx
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import { FC } from "react";
|
||||
import Image from "next/image";
|
||||
import { signOut } from "next-auth/react";
|
||||
import { Button, Box, Menu, MenuItem } from "@mui/material";
|
||||
import { useTranslate } from "react-polyglot";
|
||||
import UserIcon from "images/user-icon.png";
|
||||
import {
|
||||
usePopupState,
|
||||
bindTrigger,
|
||||
bindMenu,
|
||||
} from "material-ui-popup-state/hooks";
|
||||
import { useAppContext } from "./AppProvider";
|
||||
|
||||
export const AccountButton: FC = () => {
|
||||
const t = useTranslate();
|
||||
const {
|
||||
colors: { leafcutterElectricBlue },
|
||||
} = useAppContext();
|
||||
const popupState = usePopupState({ variant: "popover", popupId: "account" });
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
{...bindTrigger(popupState)}
|
||||
color="secondary"
|
||||
sx={{
|
||||
backgroundColor: leafcutterElectricBlue,
|
||||
width: "40px",
|
||||
height: "40px",
|
||||
minWidth: "40px",
|
||||
p: 0,
|
||||
borderRadius: "500px",
|
||||
":hover": {
|
||||
backgroundColor: leafcutterElectricBlue,
|
||||
opacity: 0.8,
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Image src={UserIcon} alt="account" width="30px" height="30px" />
|
||||
</Button>
|
||||
<Menu {...bindMenu(popupState)}>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
popupState.close();
|
||||
signOut({ callbackUrl: "/" });
|
||||
}}
|
||||
>
|
||||
<Box sx={{ width: "100%" }}>{t("signOut")}</Box>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</>
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue