react-garden
Version:
React + TypeScript + ThreeJS app using Material UI on NextJS, Apollo Client, GraphQL + WordPress REST APIs, for ThreeD web development.. a part of the threed.ai code family.
70 lines (61 loc) • 1.39 kB
JavaScript
// ** React Imports
import { useState } from 'react'
// ** MUI Imports
import Menu from '@mui/material/Menu'
import MenuItem from '@mui/material/MenuItem'
import IconButton from '@mui/material/IconButton'
// ** Icons Imports
import DotsVertical from 'mdi-material-ui/DotsVertical'
const options = [
'None',
'Atria',
'Callisto',
'Dione',
'Ganymede',
'Hangouts Call',
'Luna',
'Oberon',
'Phobos',
'Pyxis',
'Sedna',
'Titania',
'Triton',
'Umbriel'
]
const ITEM_HEIGHT = 48
const MenuMaxHeight = () => {
// ** State
const [anchorEl, setAnchorEl] = useState(null)
const handleClick = event => {
setAnchorEl(event.currentTarget)
}
const handleClose = () => {
setAnchorEl(null)
}
return (
<div>
<IconButton aria-label='more' aria-controls='long-menu' aria-haspopup='true' onClick={handleClick}>
<DotsVertical />
</IconButton>
<Menu
keepMounted
id='long-menu'
anchorEl={anchorEl}
onClose={handleClose}
open={Boolean(anchorEl)}
PaperProps={{
style: {
maxHeight: ITEM_HEIGHT * 4.5
}
}}
>
{options.map(option => (
<MenuItem key={option} selected={option === 'Pyxis'} onClick={handleClose}>
{option}
</MenuItem>
))}
</Menu>
</div>
)
}
export default MenuMaxHeight