Skip to content

Commit

Permalink
Merge pull request #73 from 3daddict/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
3daddict authored Jan 13, 2019
2 parents ee9f25b + 9af8f0a commit 13d48fc
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 7 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
31 changes: 31 additions & 0 deletions dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"Sunil Kumar Jain <[email protected]@gmail.com> (https://github.com/sunilsj99)",
"Cintia Tahirih <[email protected]> (https://github.com/cTahirih)",
"Prashant Chaudhari <[email protected]> (https://github.com/pandaa880)",
"Alexis Pandaan <[email protected]> (https://github.com/Alexius08)"
"Alexis Pandaan <[email protected]> (https://github.com/Alexius08)"
],
"license": "ISC",
"repository": {
Expand Down
32 changes: 26 additions & 6 deletions src/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,34 @@ class App extends Component {
handleClick(index) {
const newRevealStates = this.state.cardRevealStates;
newRevealStates[index] = true;

this.setState({
cardRevealStates: newRevealStates
//cards actively flipped counter
let cardsFlipped = 0;

//adds how many active cards flipped there are
newRevealStates.forEach(function(el) {
if (el === true) {
cardsFlipped++;
} else {
return;
}
});

// console.log("Clicked");
this.checkForMatch();
this.addNumberOfClicks();
//checks if only two cards are flipped
if (cardsFlipped < 3) {
//if only 2 are flipped it continues on
this.setState({
cardRevealStates: newRevealStates
});

this.checkForMatch();

this.addNumberOfClicks();
} else {
//if more then two are it returns and doesn't let you flip another
return;
}


}

addNumberOfClicks() {
Expand Down

0 comments on commit 13d48fc

Please sign in to comment.