text: /* eslint-disable flowtype/require-valid-file-annotation */
  
  import React from 'react';
  import PropTypes from 'prop-types';
  import { withStyles } from '@material-next/core/styles';
  import List, { ListItem, ListItemText } from '@material-next/core/List';
  import Menu, { MenuItem } from '@material-next/core/Menu';
  
  const styles = theme => ({
    root: {
      width: '100%',
      maxWidth: 360,
      background: theme.palette.background.paper,
    },
  });
  
  const options = [
    'Show some love to Material-Next',
    'Show all notification content',
    'Hide sensitive notification content',
    'Hide all notification content',
  ];
  
  class SimpleListMenu extends React.Component {
    state = {
      anchorEl: null,
      open: false,
      selectedIndex: 1,
    };
  
    button = undefined;
  
    handleClickListItem = event => {
      this.setState({ open: true, anchorEl: event.currentTarget });
    };
  
    handleMenuItemClick = (event, index) => {
      this.setState({ selectedIndex: index, open: false });
    };
  
    handleRequestClose = () => {
      this.setState({ open: false });
    };
  
    render() {
      const { classes } = this.props;
      return (
        <div className={classes.root}>
          <List>
            <ListItem
              button
              aria-haspopup="true"
              aria-controls="lock-menu"
              aria-label="When device is locked"
              onClick={this.handleClickListItem}
            >
              <ListItemText
                primary="When device is locked"
                secondary={options[this.state.selectedIndex]}
              />
            </ListItem>
          </List>
          <Menu
            id="lock-menu"
            anchorEl={this.state.anchorEl}
            open={this.state.open}
            onRequestClose={this.handleRequestClose}
          >
            {options.map((option, index) => (
              <MenuItem
                key={option}
                disabled={index === 0}
                selected={index === this.state.selectedIndex}
                onClick={event => this.handleMenuItemClick(event, index)}
              >
                {option}
              </MenuItem>
            ))}
          </Menu>
        </div>
      );
    }
  }
  
  SimpleListMenu.propTypes = {
    classes: PropTypes.object.isRequired,
  };
  
  export default withStyles(styles)(SimpleListMenu);
  