import React, { Component } from 'react' import styles from './SettingsMenu.css' // eslint-disable-line export default class Menu extends Component { componentDidMount() { // attach event listeners document.body.addEventListener('keydown', this.handleEscKey) } componentWillUnmount() { // remove event listeners document.body.removeEventListener('keydown', this.handleEscKey) } handleEscKey = (e) => { if (this.props.showMenu && e.which === 27) { this.props.handleModalClose() } } handleDelete = (e) => { e.preventDefault() const deleteConfirm = window.confirm("Are you sure you want to clear all completed todos?"); if (deleteConfirm) { console.log('delete') } } render() { const { showMenu } = this.props const showOrHide = (showMenu) ? 'flex' : 'none' return (