-
Notifications
You must be signed in to change notification settings - Fork 57
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
feat: AddressForm Component #128
Conversation
🚀 Preview deployed Built with commit 77032f4 https://deploy-preview-128--stoic-hodgkin-c0179e.netlify.com |
@machikoyasuda & @kieckhafer this is ready for another review |
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.
The issue I came across in the first review is resolved.
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.
@nnnnat I have a question which is probably more related to the form fields vs the AddressForm. If there is formatting set for a phone number field can we format it in real time vs when you click out of a field?
``` | ||
|
||
#### Address Form Implementation Example | ||
Simple `AddressForm` implementation example. Bind to the form element via a `ref` method that can be used my any `Button` to trigger `submit` & `validate` form methods. |
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.
Typo -- should say 'used by'
@nnnnat this is looking good! |
@rymorgan Yes the "no special character" formatter runs after each new input and on blur, I'd like to be able to pass the phone number format style to the @cassytaylor I'll update that second address field label. I can make the phone field optional in the addressForm but I thought it was required now I might be making this up tho. As for having an "optional" convey down into the component I think that's a smart idea and I think the Field component would actually take care of it, it already has an |
@reactioncommerce/design I'm also trying to resolve #163 with this PR, I think I've got the correct |
@nnnnat I think we can default it to US and from a little research (XXX) XXX-XXXX is the dominant format. The caveat here is that the component should allow the user to easily override that formatting for UK/Europe etc. But, if I understand your component, it seems like that is the case so 👍 |
@nnnnat @cassytaylor - I think your idea of having a "'(Optional)' at the end of each field label if isRequired=false" is a good one for this specific component but probably doesn't work when you think about the operator side of things. Can that be something specific to this component? Or specific to storefront components? |
@rymorgan we could make it an explicit prop on the Field component something like |
@nnnnat yea, that makes sense to me. |
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.
LGTM
🎉 This PR is included in version 0.12.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Resolves #121
Impact: minor
Type: feature
Component
Create an AddressForm component using reacto forms and preexisting form components
Validation
The Address Form component does a simple
isRequired
validation on all required fields. reacto-forms let you provide your own form validation as long as it's based on this spec this will allow users to add custom validation during implementation.PhoneNumberInput
Included in this PR is a very MVP of a PhoneNumberInput component. Currently, it's just a wrapper around the TextInput that trims all non-digit chars from the entered string.
Example: (504) 393-7303 -> 5043937303
In the future, we'd like to have a more feature rich PhoneNumberInput that includes masking and real phone number validation.
Examples:
http://catamphetamine.github.io/react-phone-number-input/
https://nosir.github.io/cleave.js/
Screenshots
Empty

Editing

Mobile

Breaking changes
N/A
Notes
@cassytaylor & @rymorgan since this component was built inside the component library I've used the input components we built several months ago so they're based on these field designs
Testing
PhoneNumberInput
will trim non-digit characters and only returns a formatted phone number (i.e: 504-123-1234 => 5041231234)