-
-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: updated App to load new component
- Loading branch information
1 parent
a8c7603
commit daf32da
Showing
3 changed files
with
92 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,68 @@ | ||
.App { | ||
text-align: center; | ||
color: #929292; | ||
} | ||
|
||
.App-logo { | ||
height: 40vmin; | ||
pointer-events: none; | ||
.gameList { | ||
color: #F5F5F5; | ||
display: grid; | ||
grid-template-columns: minmax(210px, max-content) repeat(auto-fill, 210px) 4%; | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
.App-logo { | ||
animation: App-logo-spin infinite 20s linear; | ||
} | ||
.gameCard { | ||
margin: 0 4px; | ||
background-color: #2B2B2B; | ||
text-align: left; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
width: 195px; | ||
height: 300px; | ||
border-radius: 5px; | ||
margin-bottom: 6px; | ||
} | ||
|
||
.App-header { | ||
background-color: #282c34; | ||
min-height: 100vh; | ||
.gameImg { | ||
max-height: 230px; | ||
width: 180px; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 2vmin); | ||
color: white; | ||
margin: 4px; | ||
height: 225px; | ||
} | ||
|
||
.gameTitle { | ||
text-align: center; | ||
margin: auto 4px; | ||
font-size: 14px; | ||
} | ||
|
||
.gameCard:hover { | ||
background-color: #0078F2; | ||
} | ||
|
||
.gameConfig { | ||
display: flex; | ||
} | ||
|
||
.App-link { | ||
color: #61dafb; | ||
.gameInfo { | ||
text-align: initial; | ||
margin-left: 16px; | ||
font-size: 22px; | ||
color: white; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
} | ||
|
||
@keyframes App-logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
.button { | ||
width: fit-content; | ||
padding: 0 12px; | ||
border-radius: 5px; | ||
text-transform: uppercase; | ||
} | ||
|
||
.button :hover { | ||
background-color: black; | ||
} |
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,26 +1,41 @@ | ||
import React from 'react'; | ||
import logo from './logo.svg'; | ||
import { HashRouter, Route, Switch } from 'react-router-dom'; | ||
|
||
import './App.css'; | ||
import { Library } from './components/Library'; | ||
import GameConfig from './components/UI/GameConfig'; | ||
import { getLegendaryConfig } from './helper'; | ||
|
||
function App() { | ||
const [config, setConfig] = React.useState({} as any) | ||
|
||
React.useEffect(() => { | ||
const updateConfig = async() => { | ||
const newConfig = await getLegendaryConfig() | ||
newConfig && setConfig(newConfig) | ||
} | ||
updateConfig() | ||
}, []) | ||
|
||
function App() { | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<img src={logo} className="App-logo" alt="logo" /> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to reload. | ||
</p> | ||
<a | ||
className="App-link" | ||
href="https://reactjs.org" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React | ||
</a> | ||
</header> | ||
</div> | ||
if (Object.keys(config).length) { | ||
const { user, library } = config; | ||
|
||
if (!user) { | ||
return null | ||
} | ||
|
||
return ( | ||
<HashRouter> | ||
<div className="App"> | ||
<Switch> | ||
<Route exact path="/" children={<Library library={library} user={user}/>} /> | ||
<Route exact path="/gameconfig" component={GameConfig} /> | ||
</Switch> | ||
</div> | ||
</HashRouter> | ||
); | ||
} | ||
return null | ||
} | ||
|
||
export default App; |
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