generated from jbohde/vite-apollo-mongo
-
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.
Merge pull request #91 from HarrisSte/results-fix
working on results page rendering
- Loading branch information
Showing
7 changed files
with
94 additions
and
6 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,42 @@ | ||
import Results from '../../components/Results'; | ||
import { useParams } from 'react-router-dom'; | ||
import { useEffect, useState } from 'react'; | ||
import ResultsBackground from '../../assets/results-background.png'; | ||
|
||
const GameResults = () => { | ||
const { gameId } = useParams(); | ||
|
||
useEffect(() => { | ||
fetchGame(); | ||
}, []); | ||
|
||
const [game, setGame] = useState([]); | ||
|
||
const fetchGame = async () => { | ||
await fetch( | ||
`https://api.rawg.io/api/games/${gameId}?key=bf22dc51e531456db8bc42a19dac9897` | ||
) | ||
.then((resp) => resp.json()) | ||
.then((results) => setGame(results)); | ||
}; | ||
|
||
return ( | ||
<div | ||
className='results' | ||
style={{ | ||
width: '100%', | ||
minHeight: '100vh', | ||
backgroundImage: `url(${ResultsBackground})`, | ||
backgroundSize: 'cover', | ||
backgroundPosition: 'center', | ||
overflow: 'hidden', | ||
}} | ||
> | ||
<div className='game-info'> | ||
<Results game={game} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default GameResults; |
Empty file.
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 |
---|---|---|
|
@@ -39,4 +39,4 @@ const SingleGame = () => { | |
); | ||
}; | ||
|
||
export default SingleGame; | ||
export default SingleGame; |