Skip to content

Instantly share code, notes, and snippets.

@drenther drenther/App.js
Last active Mar 5, 2019

Embed
What would you like to do?
The App component render function
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
You can’t perform that action at this time.