-
Notifications
You must be signed in to change notification settings - Fork 0
Settings page #9
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
base: basic
Are you sure you want to change the base?
Conversation
testing git
preparing for first review
BFS algorithm and path drawing added
Fix props and functions naming in buttonGrp
* after ESLint * add ESLint * use destructuring in App and fix most Lint errors in App.js.js * break up the components into separate folders
git merge --abort
* fix Nick's comments to PR#7 * fix a function name according to Nick's comments to PR#7 * fix Nick's comments to PR#7 and PR#8 * remove dist/ from git repository * add page header to settings page * add color inputs and submit button for settings page * separate AppButton component
| }; | ||
| return ( | ||
| <div className="inputWrapper"> | ||
| <label htmlFor={ `newColor${colorLetter}` }>{`color ${colorLetter}:`} |
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.
You don't need an id on an input and a for attribute on a label if the former is nested in the latter. Like here :)
It just works and that's the only way I write input labels, because it avoids dealing with ids and their uniqueness constraint.
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.
It's the ESLint...
looking for the rule I need to bend to my will so it doesn't give me the error here.
done
| return ( | ||
| <div> | ||
| { currentInstructions } | ||
| <InstructionsBox { ...instructionsProps } /> |
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.
When you've only got a prop or two, extracting them only adds cognitive load instead of reducing it. I'd inline it.
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.
done
Frankly, I was trying to keep a unified style - so that always are some kind of props passed into an element via { ...*some*Props }
but I do agree that if there are is only one prop, no point on making things more complicated
| colorLetter, | ||
| currentNewColor, | ||
| defaultText, | ||
| key: index, |
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.
Assuming the colors are unique, they would make a better index. Read about keys in react docs.
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.
Indeed a good point. I automatically dismissed all the other data since I didn't have any id passed in, but the colorLetter will be a great key in this case.
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.
done
| updateNewColor(e, colorLetter) { | ||
| const colorUpdate = {}; | ||
| colorUpdate[`newColor${colorLetter}`] = e.target.value; | ||
| this.setState(colorUpdate); |
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.
ES2015 version is a one liner:
this.setState({ [`newColor${ colorLetter }`]: e.target.value, })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.
done
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.
that's a very interesting syntax I haven't seen before
Thanks! :)
| import PageMain from '../PageMain/PageMain'; | ||
|
|
||
| export default function SettingsScreen({ setBoardColor, }) { | ||
| const headerProps = { instructions: [ 'Please enter the colors of your choice in hex format' ], }; |
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.
UX: "Please" is rarely used nowadays in microcopy texts. It doesn't add any value.
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.
done
| const linkProps = { | ||
| className: 'btn', | ||
| to: { pathname: '/', }, | ||
| children: 'Submit new colors', |
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.
UX: "Submit" is not a verb normal people use. When did you ever submit in real life last time? :)
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.
done
app/style.css
Outdated
|
|
||
| .btn, .success{ | ||
| text-decoration: none; | ||
| color: white; |
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.
Inconsistent indentation
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.
done
| @@ -102,6 +124,7 @@ | |||
| } | |||
|
|
|||
| .btn, .success{ | |||
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.
selector1,
selector2,
selectorN {
// rule
}You can add stylelint to enforce this and other rules.
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.
good idea, will have to wait until I have time to read about it and how to use it properly more.
* add validation on input entry * add validation for new color inputs * clean SettingPanel variables * add feedback and design and design the settings panel * change the color input type from text to color * add reset button * prepare for github pages deployement
It's still a work in progress, including some ideas about changing up some structures (for example passing whatever goes under
<PageMain>as children so that PageMain will become even dumber and can be used strictly for structure design purposes.Expected future additions: