Skip to content

Commit

Permalink
removed cardID from Game state
Browse files Browse the repository at this point in the history
  • Loading branch information
cmavelis committed Mar 8, 2019
1 parent 1c0453d commit 62f67c1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
3 changes: 0 additions & 3 deletions src/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class Game extends React.Component {
this.state = {
words: Array(25).fill('-'),
cardColors: cardColorsSample,
cardIDs: [0, 1, 2, 3, 4].map(i => Array(5).fill(i)),
cardShownStatus: Array(25).fill(false),
modalShown: false,
cardClicked: null,
Expand Down Expand Up @@ -235,7 +234,6 @@ class Game extends React.Component {
const {
cardShownStatus,
words,
cardIDs,
cardColors,
modalShown,
cardClicked,
Expand All @@ -257,7 +255,6 @@ class Game extends React.Component {
/>
<Board
words={words}
cardIDs={cardIDs}
squares={cardShownStatus}
onClick={this.showModal}
modalClick={this.handleCardToggle}
Expand Down
3 changes: 1 addition & 2 deletions src/components/Board.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Board extends React.Component {
}

render() {
const { cardIDs } = this.props;
const cardIDs = [0, 1, 2, 3, 4].map(i => Array(5).fill(i)); // TODO: simplify into a range
return (
<div className="game-board">
{cardIDs.map((row, i) => (
Expand All @@ -58,7 +58,6 @@ Board.propTypes = {
onClick: PropTypes.func.isRequired,
words: PropTypes.arrayOf(PropTypes.string).isRequired,
squares: PropTypes.arrayOf(PropTypes.bool).isRequired,
cardIDs: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)).isRequired,
cardColors: PropTypes.arrayOf(PropTypes.string).isRequired,
cardLeaderMarks: PropTypes.arrayOf(PropTypes.bool).isRequired,
};
Expand Down

0 comments on commit 62f67c1

Please sign in to comment.