LoadGameModal.jsx 727 B

12345678910111213141516171819202122232425262728293031323334
  1. import React from "react";
  2. import { useTranslation } from "react-i18next";
  3. import useGame from "../../hooks/useGame";
  4. import Modal from "../../ui/Modal";
  5. import LoadData from "./LoadData";
  6. const LoadGameModal = ({ show, setShow }) => {
  7. const { t } = useTranslation();
  8. const { setGame } = useGame();
  9. const loadGame = React.useCallback(
  10. (game) => {
  11. setGame(game);
  12. setShow(false);
  13. },
  14. [setGame, setShow]
  15. );
  16. return (
  17. <Modal title={t("Load game")} setShow={setShow} show={show}>
  18. <header>
  19. <h3>{t("Load previously exported work?")}</h3>
  20. </header>
  21. <section>
  22. <LoadData onLoad={loadGame} />
  23. </section>
  24. </Modal>
  25. );
  26. };
  27. export default LoadGameModal;