@@ -2,13 +2,20 @@ import { ResultScore } from "@/types/RegisterScore";
2
2
import { Button , Grid , GridItem , Text } from "@chakra-ui/react" ;
3
3
import React from "react" ;
4
4
import styles from "./GameResult.module.css" ;
5
+ import { useRouter } from "next/navigation" ;
5
6
6
7
interface GameResultProps {
7
8
nextPage : ( ) => void ;
8
9
resultScore : ResultScore ;
9
10
}
10
11
11
12
const GameResult : React . FC < GameResultProps > = ( { nextPage, resultScore } ) => {
13
+ const router = useRouter ( ) ;
14
+
15
+ const pushToRoot = ( ) => {
16
+ router . push ( "/" ) ;
17
+ } ;
18
+
12
19
return (
13
20
< div className = { styles . box } >
14
21
< Grid h = "100%" w = "100%" templateRows = "repeat(10, 1fr)" templateColumns = "repeat(10, 1fr)" gap = { 6 } bg = "white" >
@@ -86,9 +93,14 @@ const GameResult: React.FC<GameResultProps> = ({ nextPage, resultScore }) => {
86
93
{ resultScore . accuracy . toFixed ( 1 ) } %
87
94
</ Text >
88
95
</ GridItem >
89
- < GridItem colSpan = { 4 } rowSpan = { 2 } colStart = { 4 } rowStart = { 9 } className = { styles . centerText } >
90
- < Button onClick = { nextPage } colorScheme = "blue" size = "lg" w = "100%" h = "90%" >
91
- 次へ
96
+ < GridItem colSpan = { 4 } rowSpan = { 2 } colStart = { 2 } rowStart = { 9 } className = { styles . centerText } >
97
+ < Button onClick = { pushToRoot } colorScheme = "red" size = "lg" w = "80%" h = "90%" >
98
+ ゲームを終了する
99
+ </ Button >
100
+ </ GridItem >
101
+ < GridItem colSpan = { 4 } rowSpan = { 2 } colStart = { 6 } rowStart = { 9 } className = { styles . centerText } >
102
+ < Button onClick = { nextPage } colorScheme = "blue" size = "lg" w = "80%" h = "90%" >
103
+ もう一度プレイする
92
104
</ Button >
93
105
</ GridItem >
94
106
</ Grid >
0 commit comments