Skip to content

Conversation

@OriLev
Copy link
Owner

@OriLev OriLev commented Feb 3, 2018

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:

  • Validation of user input and default input values for 'no input'.
  • Adding feedback on user input validation.
  • Adding more design to the settings page.

OriLev and others added 2 commits February 4, 2018 00:02
* 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}:`}
Copy link
Collaborator

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.

Copy link
Owner Author

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 } />
Copy link
Collaborator

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.

Copy link
Owner Author

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,
Copy link
Collaborator

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.

Copy link
Owner Author

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.

Copy link
Owner Author

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);
Copy link
Collaborator

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, })

Copy link
Owner Author

Choose a reason for hiding this comment

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

done

Copy link
Owner Author

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' ], };
Copy link
Collaborator

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.

Copy link
Owner Author

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',
Copy link
Collaborator

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? :)

Copy link
Owner Author

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;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Inconsistent indentation

Copy link
Owner Author

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{
Copy link
Collaborator

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.

Copy link
Owner Author

@OriLev OriLev Feb 10, 2018

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.

OriLev and others added 7 commits February 10, 2018 19:26
* 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
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