Skip to content

Commit

Permalink
removed reset game button altogether
Browse files Browse the repository at this point in the history
  • Loading branch information
cmavelis committed Mar 3, 2019
1 parent 445460d commit 16aa797
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
9 changes: 5 additions & 4 deletions src/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,18 @@ class Game extends React.Component {

handleInputChange = (e) => {
const { name, value } = e.target;
this.setState({ [name]: value.toLowerCase() });
const newSeed = value.toLowerCase();
this.setState({ [name]: newSeed });
this.seedNewGame(newSeed);
};

getRandomWord = (wordObject) => {
const { wordList, listLength } = wordObject;
return wordList[Math.floor(Math.random() * listLength)];
};

seedNewGame = () => {
let { randomSeed } = this.state;
seedNewGame = (newSeed) => {
let randomSeed = newSeed;
const { wordList, listLength } = wordFiles.cardsClassic;
const today = new Date();
const todayValue = today.getUTCFullYear().toString()
Expand Down Expand Up @@ -249,7 +251,6 @@ class Game extends React.Component {
headerIsHidden={headerIsHidden}
toggleHeaderHide={this.toggleHeaderHide}
handleInputChange={this.handleInputChange}
seedNewGame={this.seedNewGame}
showModal={this.showModal}
/>
<Board
Expand Down
10 changes: 0 additions & 10 deletions src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const Header = ({
headerIsHidden,
toggleHeaderHide,
handleInputChange,
seedNewGame,
showModal,
}) => (
<header className={`hiding-box ${headerIsHidden ? 'hiding-box-hidden' : ''}`}>
Expand All @@ -26,15 +25,6 @@ const Header = ({
onChange={handleInputChange}
/>
</div>
<div className="utilities-box">
<button
type="button"
className="input-elements"
onClick={seedNewGame}
>
Refresh game
</button>
</div>
<div className="utilities-box">
<button
type="button"
Expand Down

0 comments on commit 16aa797

Please sign in to comment.