-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix #37: Disable non-solution keyboard characters in Jumble #40
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, please see comments for some minor suggestions.
src/components/wordInput.tsx
Outdated
const disabledLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").filter((letter: string) => { | ||
return !enabledLetters.includes(letter); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also can we move this to utils/words, something like getDisabledLettersForWord(word: string)
Don't need to use split and join everywhere either;
const reg = new RegExp(`[${targetValue}]`, "g")
const disabledCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".replace(reg, "")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion, will add the new utility function & remove redundant instances of split and join.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created a new utils function and removed all instances of split & join, how does it look?
Co-authored-by: Avikant Saini <avikantsainidbz@gmail.com>
Co-authored-by: Avikant Saini <avikantsainidbz@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks @paulkim26 🎉
Great to hear, thanks for the review! |
Fixes #37
.customButton[disabled]
CSS class in global.css.disabled
attribute is applied to non-solution keys i.e. keys not found in the targetValue property of this component.simple-keyboard
buttonAttributes option is that both an attribute AND a value must be assigned. This means that the disabled keys feature the non-standard attributedisabled="true"
vs. the standarddisabled
(which is why I could not leverage the.customButton:disabled
pseudoclass).If you see any issues with my pull request or suggestions for improvement, please let me know.
Tags:
hacktoberfest
,bug