import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; import MoreVertIcon from '@material-ui/icons/MoreVert'; import { IconButton, List, ListItem, ListItemText, Menu, MenuItem, Grid } from '@material-ui/core'; const styles = { root: { width: '100%', }, }; const options = [ 'Show some love to Material-UI', 'Show all notification content', 'Hide sensitive notification content', 'Hide all notification content', ]; const optionsOpt = [ 'None', 'Atria', 'Callisto', 'Dione', 'Ganymede', 'Hangouts Call', 'Luna', 'Oberon', 'Phobos', 'Pyxis', 'Sedna', 'Titania', 'Triton', 'Umbriel', ]; const ITEM_HEIGHT = 48; class DropdownMenu extends React.Component { state = { anchorEl: null, anchorElOpt: null, selectedIndex: 1, }; button = undefined; handleClickListItem = event => { this.setState({ anchorEl: event.currentTarget }); }; handleMenuItemClick = (event, index) => { this.setState({ selectedIndex: index, anchorEl: null }); }; handleClose = () => { this.setState({ anchorEl: null }); }; handleClickOpt = event => { this.setState({ anchorElOpt: event.currentTarget }); }; handleCloseOpt = () => { this.setState({ anchorElOpt: null }); }; render() { const { classes } = this.props; const { anchorEl, anchorElOpt } = this.state; return (
{options.map((option, index) => ( this.handleMenuItemClick(event, index)} > {option} ))} {optionsOpt.map(option => ( {option} ))}
); } } DropdownMenu.propTypes = { classes: PropTypes.object.isRequired, }; export default withStyles(styles)(DropdownMenu);