Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: リザルト画面で「ゲームを終了する」ボタンの追加 #80

Merged
merged 4 commits into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions typing-app/src/components/templates/GameResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ import { ResultScore } from "@/types/RegisterScore";
import { Button, Grid, GridItem, Text } from "@chakra-ui/react";
import React from "react";
import styles from "./GameResult.module.css";
import { useRouter } from "next/navigation";

interface GameResultProps {
nextPage: () => void;
resultScore: ResultScore;
}

const GameResult: React.FC<GameResultProps> = ({ nextPage, resultScore }) => {
const router = useRouter();

const pushToRoot = () => {
router.push("/");
};

return (
<div className={styles.box}>
<Grid h="100%" w="100%" templateRows="repeat(10, 1fr)" templateColumns="repeat(10, 1fr)" gap={6} bg="white">
Expand Down Expand Up @@ -86,9 +93,14 @@ const GameResult: React.FC<GameResultProps> = ({ nextPage, resultScore }) => {
{resultScore.accuracy.toFixed(1)}%
</Text>
</GridItem>
<GridItem colSpan={4} rowSpan={2} colStart={4} rowStart={9} className={styles.centerText}>
<Button onClick={nextPage} colorScheme="blue" size="lg" w="100%" h="90%">
次へ
<GridItem colSpan={4} rowSpan={2} colStart={2} rowStart={9} className={styles.centerText}>
<Button onClick={pushToRoot} colorScheme="red" size="lg" w="80%" h="90%">
ゲームを終了する
</Button>
</GridItem>
<GridItem colSpan={4} rowSpan={2} colStart={6} rowStart={9} className={styles.centerText}>
<Button onClick={nextPage} colorScheme="blue" size="lg" w="80%" h="90%">
KinjiKawaguchi marked this conversation as resolved.
Show resolved Hide resolved
もう一度プレイする
</Button>
</GridItem>
</Grid>
Expand Down