handling unclosable when last question

This commit is contained in:
Antoine M 2024-05-16 17:05:51 +02:00
parent 14562ee9c5
commit a68bc1e08e

View File

@ -4,11 +4,15 @@ import Modal from "../../components/ui/Modal.jsx";
import closeIcon from "../../assets/img/icons/icon-cross.svg"; import closeIcon from "../../assets/img/icons/icon-cross.svg";
export default function GameModal() { export default function GameModal() {
const { currentGameModal, setCurrentGameModal } = useGame(); const { currentGameModal, setCurrentGameModal, remainingQuestionsAmount } = useGame();
if (!currentGameModal) return null; if (!currentGameModal) return null;
return ( return (
<Modal className='game-modal' open={currentGameModal} onClose={() => setCurrentGameModal(null)}> <Modal
className='game-modal'
open={currentGameModal}
onClose={() => setCurrentGameModal(null)}
unclosable={remainingQuestionsAmount < 1 ? "true" : "false"}>
<button className='game-modal__close-button' onClick={() => setCurrentGameModal(null)}> <button className='game-modal__close-button' onClick={() => setCurrentGameModal(null)}>
<img className='close-icon' src={closeIcon} alt='close' /> <img className='close-icon' src={closeIcon} alt='close' />
</button> </button>