File tree 2 files changed +42
-2
lines changed
2 files changed +42
-2
lines changed Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import styled from 'styled-components'
3
+ import { useSelector } from 'react-redux'
4
+ import "nes.css/css/nes.min.css"
5
+
6
+ const EndScreen = ( ) => {
7
+ const lastDescription = useSelector ( ( store ) => store . games . gameStatus )
8
+
9
+ return (
10
+ < EndContainer >
11
+ < div class = "nes-container is-rounded is-dark" >
12
+ < Header > { lastDescription . description } </ Header >
13
+ < CssCredit > CSS from < a href = "https://nostalgic-css.github.io/NES.css/" > Ness.css</ a >
14
+ </ CssCredit >
15
+ </ div >
16
+ </ EndContainer >
17
+ )
18
+ }
19
+
20
+ const EndContainer = styled . section `
21
+ display: flex;
22
+ flex-direction: column;
23
+ align-items: center;
24
+ justify-content: center;
25
+ border-style: inset;
26
+ margin: 0 auto;
27
+ `
28
+ const Header = styled . h1 `
29
+ font-size: 18px;
30
+ letter-spacing: 1px;
31
+ `
32
+ const CssCredit = styled . p `
33
+ margin-top: 50px;
34
+ `
35
+ export default EndScreen
Original file line number Diff line number Diff line change @@ -4,12 +4,12 @@ import styled from 'styled-components/macro'
4
4
5
5
import { games , CarryOnGame } from '../reducers/games'
6
6
import { Container } from '../styling/GlobalStyling'
7
+ import EndScreen from './EndScreen'
7
8
8
9
const GameScreen = ( ) => {
9
10
const userName = useSelector ( store => store . games . username )
10
11
const actions = useSelector ( store => store . games . gameStatus . actions )
11
12
const history = useSelector ( store => store . games . history )
12
- // console.log(history) // history is object
13
13
14
14
const dispatch = useDispatch ( )
15
15
@@ -20,7 +20,11 @@ const GameScreen = () => {
20
20
//enables you to read the value of a property located deep within
21
21
//a chain of connected objects without having to check that each reference
22
22
//in the chain is valid.
23
-
23
+ /* if (actions.length === 0) {
24
+ return (
25
+ <EndScreen />
26
+ )
27
+ } */
24
28
return (
25
29
< Container >
26
30
< h3 > { userName . description } </ h3 >
@@ -42,6 +46,7 @@ const GameScreen = () => {
42
46
>
43
47
Go back
44
48
</ button >
49
+ < EndScreen />
45
50
</ Container >
46
51
)
47
52
}
You can’t perform that action at this time.
0 commit comments