Skip to content

Commit

Permalink
feat: updated App to load new component
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioislima committed Dec 30, 2020
1 parent a8c7603 commit daf32da
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 41 deletions.
74 changes: 52 additions & 22 deletions src/App.css
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;
}
53 changes: 34 additions & 19 deletions src/App.tsx
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;
6 changes: 6 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ body {
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: #121212;
}

a {
color: white;
text-decoration: none;
}

code {
Expand Down

0 comments on commit daf32da

Please sign in to comment.