|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import React from 'react'
|
|
|
|
|
import React, {useEffect} from 'react'
|
|
|
|
|
import styles from './Menu.module.css'
|
|
|
|
|
import useSharedState from '../../hooks/useSharedState'
|
|
|
|
|
import Inventory from '../Modals/Inventory'
|
|
|
|
@ -16,6 +16,16 @@ export default function ({containerRef}) {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
function handleKey(ev) {
|
|
|
|
|
if(ev.key !== 'Escape') return
|
|
|
|
|
setCurrentMenu(null)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
document.addEventListener('keydown', handleKey)
|
|
|
|
|
return () => document.removeEventListener('keydown', handleKey)
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div ref={containerRef} className={styles.menuBar}>
|
|
|
|
|
<MenuButton name="map" current={currentMenu} handleButton={handleButton}/>
|
|
|
|
|