frontend/src/components/TopBar/Profile.tsx

41 lines
896 B
TypeScript
Raw Normal View History

2020-06-10 21:40:33 +02:00
import { Menu, MenuItem } from "@material-ui/core";
import React, { FC } from "react";
2020-06-20 11:13:12 +02:00
import BusinessLogicContext from "../../businesslogic/BusinessLogicContext";
import { BuisnessProvided } from "../../businesslogic/BusinessLogicProvider";
2020-06-10 21:40:33 +02:00
interface ProfileProps {
2020-06-17 15:19:51 +02:00
anchorEl: HTMLElement | null;
handleClose: () => void;
2020-06-10 21:40:33 +02:00
}
2020-06-17 15:19:51 +02:00
export const Profile: FC<ProfileProps> = ({
anchorEl,
handleClose,
...restProps
}) => {
2020-06-10 21:40:33 +02:00
return (
<Menu
className="top-bar__menu"
id="simple-menu"
anchorEl={anchorEl}
keepMounted
open={Boolean(anchorEl)}
onClose={handleClose}
>
<MenuItem>Profile</MenuItem>
<MenuItem>My account</MenuItem>
2020-06-17 15:19:51 +02:00
<BusinessLogicContext.Consumer>
{(context) => (
<MenuItem
onClick={() => {
(context as BuisnessProvided).reducers();
}}
>
Logout
</MenuItem>
)}
</BusinessLogicContext.Consumer>
2020-06-10 21:40:33 +02:00
</Menu>
);
};