frontend/src/components/Profile.tsx

20 lines
561 B
TypeScript
Raw Normal View History

2020-08-17 19:21:14 +02:00
import { Menu, MenuItem } from '@material-ui/core';
2020-08-17 23:56:34 +02:00
import React, { useContext } from 'react';
import { CASContext } from '../contexts/CASProvider';
2020-06-10 21:40:33 +02:00
interface ProfileProps {
2020-08-17 19:21:14 +02:00
anchorEl: HTMLElement | null;
handleClose: () => void;
2020-06-10 21:40:33 +02:00
}
2020-08-17 23:56:34 +02:00
export const Profile = ({ anchorEl, handleClose }: ProfileProps) => {
const { logout } = useContext(CASContext)!;
2020-08-17 19:21:14 +02:00
return (
2020-08-17 23:56:34 +02:00
<Menu anchorEl={anchorEl} keepMounted open={Boolean(anchorEl)} onClose={handleClose}>
2020-11-08 18:05:21 +01:00
<MenuItem>Profil</MenuItem>
<MenuItem onClick={logout}>Wyloguj</MenuItem>
2020-08-17 19:21:14 +02:00
</Menu>
);
2020-06-10 21:40:33 +02:00
};