forked from Idautterstrom/project-labyrinth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc79fd2
commit 2201e89
Showing
6 changed files
with
76 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react' | ||
import { useDispatch, useSelector } from 'react-redux' | ||
import { nextStep } from 'reducers/game' | ||
import styled from 'styled-components' | ||
|
||
const HistoryContainer = styled.div` | ||
position: fixed; | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 5px; | ||
margin: 10px; | ||
bottom: 0; | ||
` | ||
const Button = styled.button` | ||
width: 40px; | ||
height: 40px; | ||
` | ||
|
||
export const History = () => { | ||
const dispatch = useDispatch() | ||
const history = useSelector(store => store.game.history) | ||
return ( | ||
<HistoryContainer> | ||
{history?.map(action => ( | ||
<Button type='button' onClick={() => dispatch(nextStep(action))}> | ||
{action.direction === 'North' | ||
? ' ⬆' //↑ | ||
: action.direction === 'South' | ||
? ' ⬇' //↓ | ||
: action.direction === 'West' | ||
? ' ⬅' //→ | ||
: action.direction === 'East' | ||
? ' ➡' //← | ||
: ''} | ||
</Button> | ||
))} | ||
</HistoryContainer> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
body { | ||
margin: 20px; | ||
font-family: "IBM Plex Mono", monospace; | ||
font-family: 'IBM Plex Mono', monospace; | ||
color: black; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
code { | ||
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", | ||
monospace; | ||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; | ||
} | ||
|
||
input[type='text'], | ||
select:focus, | ||
textarea { | ||
font-size: 16px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters