@mui/icons-material#MoreVert TypeScript Examples
The following examples show how to use
@mui/icons-material#MoreVert.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlayBar.tsx From rewind with MIT License | 5 votes |
function MoreMenu() {
const [anchorEl, setAnchorEl] = useState(null);
const open = Boolean(anchorEl);
const handleClick = (event: any) => {
setAnchorEl(event.currentTarget);
};
const handleClose = () => {
setAnchorEl(null);
};
const analyzer = useAnalysisApp();
const handleTakeScreenshot = () => {
analyzer.screenshotTaker.takeScreenshot();
handleClose();
};
const [helpOpen, setHelpOpen] = useState(false);
const handleOpenHelp = () => {
setHelpOpen(true);
handleClose();
};
return (
<>
<HelpModalDialog isOpen={helpOpen} onClose={() => setHelpOpen(false)} />
<IconButton
aria-label="more"
id="long-button"
aria-controls="long-menu"
// aria-expanded={open ? "true" : undefined}
aria-haspopup="true"
onClick={handleClick}
onFocus={ignoreFocus}
>
<MoreVert />
</IconButton>
<Menu
open={open}
onClose={handleClose}
anchorEl={anchorEl}
anchorOrigin={{
vertical: "top",
horizontal: "center",
}}
transformOrigin={{
vertical: "bottom",
horizontal: "center",
}}
>
<MenuItem onClick={handleTakeScreenshot}>
<ListItemIcon>
<PhotoCamera />
</ListItemIcon>
<ListItemText>Take Screenshot</ListItemText>
</MenuItem>
<MenuItem onClick={handleOpenHelp}>
<ListItemIcon>
<Help />
</ListItemIcon>
<ListItemText>Help</ListItemText>
</MenuItem>
</Menu>
</>
);
}
Example #2
Source File: CollectionRowActions.tsx From firecms with MIT License | 4 votes |
/**
*
* @param entity
* @param isSelected
* @param selectionEnabled
* @param size
* @param toggleEntitySelection
* @param onCopyClicked
* @param onEditClicked
* @param onDeleteClicked
* @constructor
*
* @category Collection components
*/
export function CollectionRowActions<M extends { [Key: string]: any }>({
entity,
isSelected,
selectionEnabled,
size,
toggleEntitySelection,
onCopyClicked,
onEditClicked,
onDeleteClicked
}:
{
entity: Entity<M>,
size: CollectionSize,
isSelected?: boolean,
selectionEnabled?: boolean,
toggleEntitySelection?: (selectedEntity: Entity<M>) => void
onEditClicked?: (selectedEntity: Entity<M>) => void,
onCopyClicked?: (selectedEntity: Entity<M>) => void,
onDeleteClicked?: (selectedEntity: Entity<M>) => void,
}) {
const editEnabled = Boolean(onEditClicked);
const copyEnabled = Boolean(onCopyClicked);
const deleteEnabled = Boolean(onDeleteClicked);
const classes = useTableStyles();
const [anchorEl, setAnchorEl] = React.useState<any | null>(null);
const openMenu = useCallback((event: React.MouseEvent) => {
setAnchorEl(event.currentTarget);
event.stopPropagation();
}, [setAnchorEl]);
const closeMenu = useCallback(() => {
setAnchorEl(null);
}, [setAnchorEl]);
const onCheckboxChange = (event: React.ChangeEvent) => {
if (toggleEntitySelection)
toggleEntitySelection(entity);
event.stopPropagation();
};
const onDeleteClick = useCallback((event: MouseEvent) => {
event.stopPropagation();
if (onDeleteClicked)
onDeleteClicked(entity);
setAnchorEl(null);
}, [entity, onDeleteClicked, setAnchorEl]);
const onCopyClick = useCallback((event: MouseEvent) => {
event.stopPropagation();
if (onCopyClicked)
onCopyClicked(entity);
setAnchorEl(null);
}, [entity, onCopyClicked, setAnchorEl]);
return (
<div className={classes.cellButtonsWrap}>
{(editEnabled || deleteEnabled || selectionEnabled) &&
<div className={classes.cellButtons}
>
{editEnabled &&
<Tooltip title={`Edit ${entity.id}`}>
<IconButton
onClick={(event: MouseEvent) => {
event.stopPropagation();
if (onEditClicked)
onEditClicked(entity);
}}
size="large">
<KeyboardTab/>
</IconButton>
</Tooltip>
}
{selectionEnabled &&
<Tooltip title={`Select ${entity.id}`}>
<Checkbox
checked={isSelected}
onChange={onCheckboxChange}
/>
</Tooltip>}
{(copyEnabled || deleteEnabled) &&
<IconButton onClick={openMenu} size="large">
<MoreVert/>
</IconButton>
}
{(copyEnabled || deleteEnabled) && <Menu
anchorEl={anchorEl}
open={Boolean(anchorEl)}
onClose={closeMenu}
elevation={2}
>
{deleteEnabled && <MenuItem onClick={onDeleteClick}>
<ListItemIcon>
<Delete/>
</ListItemIcon>
<ListItemText primary={"Delete"}/>
</MenuItem>}
{copyEnabled && <MenuItem onClick={onCopyClick}>
<ListItemIcon>
<FileCopy/>
</ListItemIcon>
<ListItemText primary="Copy"/>
</MenuItem>}
</Menu>}
</div>}
{size !== "xs" && (
<div className={classes.cellButtonsId}>
{entity
? <Typography
className={"mono"}
variant={"caption"}
color={"textSecondary"}> {entity.id} </Typography>
: <Skeleton variant="text"/>
}
</div>
)}
</div>
);
}
Example #3
Source File: CommentItemModule.tsx From bouncecode-cms with GNU General Public License v3.0 | 4 votes |
function CommentItemModule({post, comment}: ICommentItemModule) {
const [moreVert, setMoreVert] = React.useState(null);
const openMoreVert = Boolean(moreVert);
const toggleMoreVert = open => {
return event => {
if (open) {
setMoreVert(event.currentTarget);
} else {
setMoreVert(null);
}
};
};
const [commentDrawer, setCommentDrawer] = React.useState(null);
const toggleCommentDrawer = open => {
return event => {
if (
event.type === 'keydown' &&
(event.key === 'Tab' || event.key === 'Shift')
) {
return;
}
setCommentDrawer(open);
};
};
const [
emotionMutation,
{loading: emotionLoading},
] = useCommentEmotionMutation();
const [
undoEmotionMutation,
{loading: undoEmotionLoading},
] = useCommentEmotionUndoMutation();
const updateEmotion = emotion => {
return () => {
console.log(myEmotion);
console.log(emotion);
if (myEmotion === emotion.toLowerCase()) {
undoEmotionMutation({
variables: {
where: {
id: comment.id,
},
},
refetchQueries: [
{
query: CommentMyEmotionDocument,
variables: {where: {id: comment.id}},
},
],
});
} else {
emotionMutation({
variables: {
where: {
id: comment.id,
},
data: {emotion},
},
refetchQueries: [
{
query: CommentMyEmotionDocument,
variables: {where: {id: comment.id}},
},
],
});
}
};
};
const {
data: myEmotionData,
loading: myEmotionLoading,
} = useCommentMyEmotionQuery({
variables: {where: {id: comment.id}},
});
const myEmotion = myEmotionData?.commentMyEmotion?.emotion;
return (
<Grid container direction="column" spacing={1}>
<Grid item>
<Grid container spacing={2}>
<Grid item>
<Avatar></Avatar>
</Grid>
<Grid item xs>
<Grid container direction="column" spacing={1}>
<Grid item>
<Grid container spacing={2} alignItems="center">
<Grid item>
<Typography variant="body2">
{comment.user.email}
</Typography>
</Grid>
<Grid item>
<Typography variant="caption">
{formatDistance(
new Date(comment.createdDate),
new Date(),
{addSuffix: true},
)}
</Typography>
</Grid>
</Grid>
</Grid>
<Grid item>
<Typography variant="body1">{comment.text}</Typography>
</Grid>
<Grid
container
justifyContent="space-between"
alignItems="center">
<Grid item>
<Grid container alignItems="center">
<Grid item>
<Button
variant="text"
size="small"
startIcon={<ThumbUpOutlined />}
onClick={updateEmotion('LIKE')}
disabled={
myEmotionLoading ||
emotionLoading ||
undoEmotionLoading
}>
{comment.like || ''}
</Button>
</Grid>
<Grid item>
<Button
variant="text"
size="small"
startIcon={<ThumbDownOutlined />}
onClick={updateEmotion('UNLIKE')}
disabled={
myEmotionLoading ||
emotionLoading ||
undoEmotionLoading
}>
{comment.unlike || ''}
</Button>
</Grid>
{post ? (
<Grid item>
<Button
variant="text"
size="small"
onClick={toggleCommentDrawer(true)}
disabled>
답글
</Button>
<Drawer
anchor="bottom"
open={commentDrawer}
onClose={toggleCommentDrawer(false)}>
<Container maxWidth="md">
<Box pt={2} pb={2}>
<CommentCreateFormModule />
</Box>
</Container>
</Drawer>
</Grid>
) : (
undefined
)}
</Grid>
</Grid>
<Grid item>
<IconButton onClick={toggleMoreVert(true)} disabled>
<MoreVert fontSize="small" />
</IconButton>
<Menu
anchorEl={moreVert}
open={openMoreVert}
onClose={toggleMoreVert(false)}>
<MenuItem
// selected={option === 'Pyxis'}
onClick={toggleMoreVert(false)}>
<ListItemIcon>
<AssistantPhotoOutlined />
</ListItemIcon>
<Typography variant="inherit">신고</Typography>
</MenuItem>
</Menu>
</Grid>
</Grid>
{/* {post ? (
<Grid item>
<Grid container direction="column" spacing={2}>
<Grid item>
<Button
variant="text"
size="small"
startIcon={<KeyboardArrowDown />}>
답글 1개 보기
</Button>
</Grid>
<Grid item>
<CommentItemModule comment />
</Grid>
</Grid>
</Grid>
) : (
undefined
)} */}
</Grid>
</Grid>
</Grid>
</Grid>
</Grid>
);
}
Example #4
Source File: Navbar.tsx From website with Apache License 2.0 | 4 votes |
Navbar = ({
rootPageHasAnimation,
}: {
rootPageHasAnimation?: boolean;
}) => {
const [drawerState, setDrawerState] = useState(false);
const [toggleMoreIcon, setToggleMoreIcon] = useState(false);
const [initialPageWidth, setInitialPageWidth] = useState(0);
const theme = useTheme();
const ref = useRef<HTMLButtonElement | null>(null);
/* In the future we should come up with a different solution that doesn't
rerender this component, its not much of a problem right now but later it
*may* become a problem
- Cody
*/
const scrollPos = useScrollPosition(15);
const toggleDrawer = useCallback(
(open: boolean = false) => setDrawerState(open ?? !drawerState),
[drawerState],
);
useEffect(() => {
// This is used for checking if its mobile or not
setInitialPageWidth(window.innerWidth);
}, []);
return (
<Wrapper>
<SkipNavLink
contentId="skipNav"
style={{
background: theme.background.backgroundColor,
color:
theme.type === "dark"
? theme.text.textColorExtremelyLight
: theme.text.textColorDark,
zIndex: 9999999,
}}
/>
<Drawer
anchor="left"
open={drawerState}
onClose={() => toggleDrawer(false)}
>
<DrawerLogoContainer>
<DrawerLogo
alt="dahliaOS logo"
src={
theme.type === "dark"
? "/images/logos/logo-white.png"
: "/images/logos/logo-color.png"
}
/>
</DrawerLogoContainer>
<Container>
<Link href="/#features">Features</Link>
<Link href="/#download">Download</Link>
<Link href="mailto:[email protected]">Contact</Link>
<Link href="https://github.com/orgs/dahliaos/people" target="_blank">
Developers
</Link>
<Link href="https://docs.dahliaOS.io">Documentation</Link>
<Divider />
<Category>Find us on</Category>
<Link href="/discord" target="_blank">
Discord
</Link>
<Link href="/github" target="_blank">
GitHub
</Link>
<Link href="/reddit" target="_blank">
Reddit
</Link>
<Link href="/telegram" target="_blank">
Telegram
</Link>
<Link href="/facebook" target="_blank">
Facebook
</Link>
<Link href="/instagram" target="_blank">
Instagram
</Link>
<Link href="/twitter" target="_blank">
Twitter
</Link>
<Divider />
<Category>For developers</Category>
<Link href="/github">Source Code</Link>
<Link href="/discord">Join Our Team</Link>
</Container>
</Drawer>
<StyledAppBar
rootPageHasAnimation={
initialPageWidth < 1075 ? false : rootPageHasAnimation
}
position="fixed"
scrollPos={scrollPos}
>
<StyledToolbar scrollPos={scrollPos}>
<IconButton
edge="start"
color="inherit"
aria-label="menu"
onClick={() => toggleDrawer(true)}
>
<MenuIcon
style={
theme.type === "dark"
? undefined
: { color: theme.text.textColorDark }
}
/>
</IconButton>
<AppBarLogoLinkContainer href="/">
<AppBarLogo
alt="dahliaOS logo"
src={
theme.type === "dark"
? "/images/logos/logo-white.png"
: "/images/logos/logo-color.png"
}
draggable={false}
/>
</AppBarLogoLinkContainer>
<DesktopNav>
<AppBarLink href="/#features">Features</AppBarLink>
<AppBarLink href="/#download">Download</AppBarLink>
<AppBarLink href="https://web.dahliaOS.io" target="_blank">
Demo
</AppBarLink>
<AppBarLink
href="https://github.com/orgs/dahliaos/people"
target="_blank"
>
Developers
</AppBarLink>
<AppBarLink href="https://docs.dahliaOS.io">
Documentation
</AppBarLink>
<IconButton
ref={ref}
aria-label="nav-more"
aria-haspopup="true"
onClick={() => setToggleMoreIcon(true)}
>
<MoreVert style={{ color: theme.text.textColorLight }} />
</IconButton>
<Menu
open={toggleMoreIcon}
onClose={() => setToggleMoreIcon(false)}
anchorOrigin={{ vertical: "bottom", horizontal: "left" }}
anchorEl={ref.current}
keepMounted
>
<MenuItem>
<MenuLink href="/github" target="_blank">
Source Code
</MenuLink>
</MenuItem>
<MenuItem disabled>Screenshots</MenuItem>
</Menu>
</DesktopNav>
</StyledToolbar>
</StyledAppBar>
<SkipNavContent id="skipNav" />
</Wrapper>
);
}