Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Web/refactor/input usage #60

Merged
merged 13 commits into from
Aug 31, 2018
Merged

Web/refactor/input usage #60

merged 13 commits into from
Aug 31, 2018

Conversation

chamkank
Copy link
Contributor

@chamkank chamkank commented Aug 18, 2018

🎟️ Ticket(s): Closes #57


👷 Changes

Just a small refactor of our input components to use the same conventions before we move forward with the rest of the components. Here are the changes:

  1. Used implicit labels instead of explicit labels so we don't need to have a unique id for each component (just the input name instead).
  2. Added type field to PrimaryButton and SecondaryButton (see notes).
  3. Updated usage of input components.
  4. Updated tests.

💭 Notes

For PrimaryButton, SecondaryButton, and ProgressGroup, the name is optional. For the buttons, the button type becomes submit if you provide a value for name. If you don't provide a name value, the button type defaults to button. You can also explicitly define the type (to submit, button, or reset with the default being button) of PrimaryButton and SecondaryButton.

Copy link
Contributor

@bobheadxi bobheadxi left a comment

Choose a reason for hiding this comment

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

noice

@@ -246,7 +246,7 @@ describe('Hacker component', () => {
});

it('page one is rendered', () => {
expect(wrapper.find('div#hacker-application-page-1')).toHaveLength(1);
expect(wrapper.find('form#hacker-application-page-1')).toHaveLength(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

@mingyokim an example of the potentially-overly-specific-tests i talked about the other day

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, i get it now. i'll try to avoid these patterns next time

Copy link
Contributor

@mingyokim mingyokim left a comment

Choose a reason for hiding this comment

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

submit button doesn't work in /login :/

disabled={disabled}
className={`primary ${className}`}>
className={`primary ${className}`}
form={name}>
Copy link
Contributor

Choose a reason for hiding this comment

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

do we really need form here? It's not submitting even when the type is submit if form is defined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, form was supposed to equal the form-id but I made it the form-name. Fixed by fd5ad1c. The commit also removes this attribute altogether since it's only really useful in the extreme case where you want to associate a button with a form when it's outside the <form> tags.

@mingyokim mingyokim mentioned this pull request Aug 20, 2018
3 tasks
The use case for this is pretty rare
It doesn't pick up type defined through defaultProps (since it's dynamic), so we have to set this to warn or disable it altogether.
@@ -22,6 +22,7 @@
"react/prefer-stateless-function": 0,
"react/no-did-mount-set-state": 0,
"react/jsx-one-expression-per-line": 0,
"react/button-has-type": 1,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chamkank
Copy link
Contributor Author

Thanks guys!

@chamkank chamkank merged commit 18bf298 into master Aug 31, 2018
@chamkank chamkank deleted the web/refactor/input-usage branch September 3, 2018 23:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants