Skip to content
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: Support generic validation messages on inputs. #110

Merged
merged 20 commits into from
Sep 5, 2019

Conversation

darryltec
Copy link
Contributor

@darryltec darryltec commented Sep 3, 2019

Changes

  • This allows us to have a success error warn info messages on inputs
  • This also includes some sort of criteria on when should the message show up like
{
  shouldShow: value !== 'Jeff',
  message: 'Your name is supposed to be Jeff',
  status: 'error',
}

Sep-03-2019 15-59-25

Added

  • A separate input validation component to show error messages outside of the form field

image

Changed

Deprecated

Removed

Fixed

Security

Testing


In Atlantis we use Github's built in pull request reviews.

Random photo of Atlantis

@netlify
Copy link

netlify bot commented Sep 3, 2019

Deploy preview for jobber-atlantis ready!

Built with commit 90ea008

https://deploy-preview-110--jobber-atlantis.netlify.com

@darryltec darryltec requested review from seanhealy and a team September 3, 2019 22:01
Copy link
Contributor

@seanhealy seanhealy left a comment

Choose a reason for hiding this comment

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

Few little thoughts for you.

packages/components/src/FormField/FormField.tsx Outdated Show resolved Hide resolved
packages/components/src/FormField/FormField.tsx Outdated Show resolved Hide resolved
@seanhealy seanhealy changed the title Support generic validation messages on inputs Support generic validation messages on inputs. Sep 4, 2019
Copy link
Contributor

@seanhealy seanhealy left a comment

Choose a reason for hiding this comment

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

Two little things then I'm good.

@@ -166,13 +186,23 @@ export const FormField = React.forwardRef(
handleValidation();
}, [value]);

let hasErrors = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Was just thinking we could make a little function that would return hasErrors this would let us do something like const hasErrors = areThereMessages(validations) here which would simplify reading this component and then isolate this logic into a method. Also, it's an excuse to use VSCode's fancy refactor tools!

## Validation message

You can add your own custom validation messages on a field. However, this
shouldn't replace of your server-side validation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
shouldn't replace of your server-side validation.
shouldn't replace server-side validation.

@seanhealy seanhealy changed the title Support generic validation messages on inputs. feat: Support generic validation messages on inputs. Sep 5, 2019
@seanhealy seanhealy merged commit 07c1bf7 into master Sep 5, 2019
@seanhealy seanhealy deleted the support-success-and-warn-messages-on-inputs branch September 5, 2019 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants