File size: 1,594 Bytes
6c2bcb4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { useState, MouseEvent } from "react";
import IconButton from "@mui/material/IconButton";
import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem";
import InfoIcon from "@mui/icons-material/Info";
import { useRouter } from "next/router";

export function InfoMenu() {
	const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
	const open = Boolean(anchorEl);
	const handleClick = (event: MouseEvent<HTMLElement>) => {
		setAnchorEl(event.currentTarget);
	};
	const router = useRouter();
	const handleClose = () => {
		setAnchorEl(null);
	};

	return (
		<div>
			<IconButton
				aria-label="Info"
				id="infoMenu-button"
				aria-controls={open ? "infoMenu-menu" : undefined}
				aria-expanded={open ? "true" : undefined}
				aria-haspopup="true"
				onClick={handleClick}
			>
				<InfoIcon />
			</IconButton>
			<Menu
				id="infoMenu-menu"
				MenuListProps={{
					"aria-labelledby": "infoMenu-button",
				}}
				anchorEl={anchorEl}
				open={open}
				onClose={handleClose}
				PaperProps={{
					style: {
						width: "20ch",
					},
				}}
			>
				<MenuItem
					onClick={async () => {
						await router.push("/legal/data-policy");
						handleClose();
					}}
				>
					Data Policy
				</MenuItem>
				<MenuItem
					onClick={async () => {
						await router.push("/legal/imprint");
						handleClose();
					}}
				>
					Imprint
				</MenuItem>
				<MenuItem
					onClick={async () => {
						await router.push("/legal/cookie-policy");
						handleClose();
					}}
				>
					Cookie Policy
				</MenuItem>
			</Menu>
		</div>
	);
}