lhoist-stay-safe/src/components/game/GameModal.jsx
2024-02-21 11:06:50 +01:00

19 lines
660 B
JavaScript

import React from "react";
import { useGame } from "../../hooks/useGame";
import Modal from "../../components/ui/Modal.jsx";
import closeIcon from "../../assets/img/icons/icon-cross.svg";
export default function GameModal() {
const { currentGameModal, setCurrentGameModal } = useGame();
if (!currentGameModal) return null;
return (
<Modal className='game-modal' open={currentGameModal} onClose={() => setCurrentGameModal(null)}>
<button className='game-modal__close-button' onClick={() => setCurrentGameModal(null)}>
<img className='close-icon' src={closeIcon} alt='close' />
</button>
{currentGameModal}
</Modal>
);
}