add settings button context menu (nonfunctional parts)
This commit is contained in:
parent
1d0a0bf210
commit
c296241841
44
src/components/sidebar/SettingsButton.tsx
Normal file
44
src/components/sidebar/SettingsButton.tsx
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import { Settings } from "@mui/icons-material";
|
||||||
|
import { IconButton, Menu, MenuItem } from "@mui/material";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const SettingsButton: React.FC = () => {
|
||||||
|
|
||||||
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
||||||
|
const open = Boolean(anchorEl);
|
||||||
|
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
|
setAnchorEl(event.currentTarget);
|
||||||
|
};
|
||||||
|
const handleClose = () => {
|
||||||
|
setAnchorEl(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<IconButton
|
||||||
|
sx={{ position: "absolute", right: 0 }}
|
||||||
|
aria-controls={open ? "context-menu" : undefined}
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-expanded={open ? "true" : undefined}
|
||||||
|
onClick={handleClick}>
|
||||||
|
<Settings />
|
||||||
|
</IconButton>
|
||||||
|
<Menu
|
||||||
|
id="context-menu"
|
||||||
|
anchorEl={anchorEl}
|
||||||
|
open={open}
|
||||||
|
onClose={handleClose}
|
||||||
|
MenuListProps={{ "aria-labelledby": "basic-button" }}
|
||||||
|
>
|
||||||
|
<MenuItem onClick={handleClose}>Remove from Favourites</MenuItem>
|
||||||
|
<MenuItem onClick={handleClose}>View current meeting</MenuItem>
|
||||||
|
<MenuItem onClick={handleClose}>View upcoming meetings</MenuItem>
|
||||||
|
<MenuItem onClick={handleClose}>Create meeting</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SettingsButton;
|
||||||
@ -2,7 +2,7 @@ import { Divider, Drawer, List, ListItem, ListSubheader } from "@mui/material";
|
|||||||
import GroupSelect from "./GroupSelect";
|
import GroupSelect from "./GroupSelect";
|
||||||
import SidebarUser, { SidebarUserObj } from "./SidebarUser";
|
import SidebarUser, { SidebarUserObj } from "./SidebarUser";
|
||||||
|
|
||||||
// TODO: SidebarUser icon button context menu
|
// TODO: toolbar on top of sidebar since it goes under the navbar
|
||||||
|
|
||||||
const drawerWidth = 240;
|
const drawerWidth = 240;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ const Sidebar: React.FC<Props> = ({ users }: Props) => {
|
|||||||
variant="permanent"
|
variant="permanent"
|
||||||
anchor="right"
|
anchor="right"
|
||||||
>
|
>
|
||||||
<List disablePadding sx={{ height: "90%", overflow: "auto" }}>
|
<List disablePadding sx={{ height: "80%", overflow: "auto" }}>
|
||||||
<ListSubheader disableGutters>
|
<ListSubheader disableGutters>
|
||||||
<GroupSelect />
|
<GroupSelect />
|
||||||
</ListSubheader>
|
</ListSubheader>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Settings } from "@mui/icons-material";
|
import { Box, Typography } from "@mui/material";
|
||||||
import { Box, IconButton, Typography } from "@mui/material";
|
import SettingsButton from "./SettingsButton";
|
||||||
|
|
||||||
export interface SidebarUserObj {
|
export interface SidebarUserObj {
|
||||||
id: number,
|
id: number,
|
||||||
@ -62,9 +62,7 @@ const SidebarUser: React.FC<Props> = ({ user }: Props) => {
|
|||||||
<Typography variant="h6">{user.name}</Typography>
|
<Typography variant="h6">{user.name}</Typography>
|
||||||
<Typography variant="caption">{getMeetingStatusText(user.meetingStatus)}</Typography>
|
<Typography variant="caption">{getMeetingStatusText(user.meetingStatus)}</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<IconButton sx={{ position: "absolute", right: 0 }}>
|
<SettingsButton />
|
||||||
<Settings />
|
|
||||||
</IconButton>
|
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user