1
1
import React from 'react' ;
2
2
import Button from '../components/UI/Button' ;
3
3
import classes from './GameOverScreen.module.css' ;
4
+ import { ReactComponent as FalseIcon } from '../assets/img/icons/false-icon.svg' ;
5
+ import { ReactComponent as CorrectIcon } from '../assets/img/icons/correct-icon.svg' ;
4
6
5
7
const GameOverScreen = ( props ) => {
6
8
const { trueAnswers, falseAnswers } = props ;
@@ -12,10 +14,13 @@ const GameOverScreen = (props) => {
12
14
{ ( trueAnswers . length / props . questions . length ) * 100 } %)
13
15
</ h1 >
14
16
15
- { falseAnswers . length !== 0 && (
17
+ { trueAnswers . length !== 0 && (
16
18
< div className = { classes [ 'answers-container' ] } >
17
- < span className = { classes [ 'answers-title' ] } > False answers:</ span >
18
- { falseAnswers . map ( ( answer ) => (
19
+ < span className = { classes [ 'answers-title' ] } >
20
+ < CorrectIcon className = { classes . icon } />
21
+ True answers:
22
+ </ span >
23
+ { trueAnswers . map ( ( answer ) => (
19
24
< div
20
25
key = { answer . question . id }
21
26
className = { classes [ 'question-container' ] }
@@ -24,37 +29,42 @@ const GameOverScreen = (props) => {
24
29
{ answer . questionNumber } . { answer . question . question }
25
30
</ span >
26
31
< span className = { classes [ 'question-answer' ] } >
27
- Your answer: { answer . question . answers [ answer . userAnswer ] }
28
- </ span >
29
- < span className = { classes [ 'question-answer' ] } >
30
- Correct answer: { answer . question . answers [ answer . correctAnswer ] }
32
+ < CorrectIcon className = { classes . icon } />
33
+ { answer . question . answers [ answer . userAnswer ] }
31
34
</ span >
32
35
</ div >
33
36
) ) }
34
37
</ div >
35
38
) }
36
39
37
- { trueAnswers . length !== 0 && (
40
+ { falseAnswers . length !== 0 && (
38
41
< div className = { classes [ 'answers-container' ] } >
39
- < span className = { classes [ 'answers-title' ] } > True answers:</ span >
40
- { trueAnswers . map ( ( answer ) => (
42
+ < span className = { classes [ 'answers-title' ] } >
43
+ < FalseIcon className = { classes . icon } />
44
+ False answers:
45
+ </ span >
46
+ { falseAnswers . map ( ( answer ) => (
41
47
< div
42
48
key = { answer . question . id }
43
49
className = { classes [ 'question-container' ] }
44
50
>
45
51
< span className = { classes [ 'question-title' ] } >
46
52
{ answer . questionNumber } . { answer . question . question }
47
53
</ span >
54
+
48
55
< span className = { classes [ 'question-answer' ] } >
49
- Your answer: { answer . question . answers [ answer . userAnswer ] }
56
+ < FalseIcon className = { classes . icon } />
57
+ { answer . question . answers [ answer . userAnswer ] }
50
58
</ span >
51
59
< span className = { classes [ 'question-answer' ] } >
52
- Correct answer: { answer . question . answers [ answer . correctAnswer ] }
60
+ < CorrectIcon className = { classes . icon } />
61
+ { answer . question . answers [ answer . correctAnswer ] }
53
62
</ span >
54
63
</ div >
55
64
) ) }
56
65
</ div >
57
66
) }
67
+
58
68
< Button onClick = { ( ) => window . location . reload ( false ) } text = "Try Again!" />
59
69
</ div >
60
70
) ;
0 commit comments