Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap case when spacebar is typed #2

Merged
merged 1 commit into from
Sep 4, 2020
Merged

Wrap case when spacebar is typed #2

merged 1 commit into from
Sep 4, 2020

Conversation

victorpre
Copy link
Owner

No description provided.

@victorpre victorpre merged commit a4544f1 into master Sep 4, 2020
@victorpre victorpre deleted the spacebar branch September 4, 2020 09:51
Copy link

@alecarneiro1993 alecarneiro1993 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some insights

updatedWords[wordIndex][letterIndex] = newCurrent;

// mark all remaining non-typed chars as incorrect
for (var i = letter; i < words[word].length; i++) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either each from lodash or forEach from js. Actually I'd use map

map(words[word], (w, index) => 
 ({ ...updatedWords[word][index], current: false, correct: false })
)

@@ -100,6 +126,8 @@ function Words() {
useKeyPress( k => {
if (k === "Backspace") {
backspaceTyped();
} else if (k === " ") {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch/case also works here. just fyi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants