Last active
March 5, 2019 20:25
-
-
Save drenther/8d67f7614c61f78c8517ae83e8199e75 to your computer and use it in GitHub Desktop.
The App component render function
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
class App extends React.Component { | |
render() { | |
const { gameState, timeLeft, bench, ...groups } = this.state; | |
const isDropDisabled = gameState === GAME_STATE.DONE; | |
return ( | |
<> | |
<Header gameState={gameState} timeLeft={timeLeft} endGame={this.endGame} /> | |
{this.state.gameState !== GAME_STATE.PLAYING && ( | |
<Modal | |
startGame={this.startGame} | |
resetGame={this.resetGame} | |
timeLeft={timeLeft} | |
gameState={gameState} | |
groups={groups} | |
/> | |
)} | |
{(this.state.gameState === GAME_STATE.PLAYING || | |
this.state.gameState === GAME_STATE.DONE) && ( | |
<DragDropContext onDragEnd={this.onDragEnd}> | |
<div className="container"> | |
<div className="columns"> | |
<Dropzone | |
id={COMICS.MARVEL} | |
heroes={this.state[COMICS.MARVEL]} | |
isDropDisabled={isDropDisabled} | |
/> | |
<Dropzone id="bench" heroes={bench} isDropDisabled={isDropDisabled} /> | |
<Dropzone | |
id={COMICS.DC} | |
heroes={this.state[COMICS.DC]} | |
isDropDisabled={isDropDisabled} | |
/> | |
</div> | |
</div> | |
</DragDropContext> | |
)} | |
<Footer /> | |
</> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment