coforma / swift-tech-challenge

MIT License
0 stars 0 forks source link

Bugfix/form validation #170

Closed ntsummers1 closed 5 months ago

ntsummers1 commented 5 months ago

Title

Bugfix/form validation

Summary

This PR adds validation to the application form. It does a pretty big re-write of the app form to use Formik, a really nice form generation tool. It enabled error messaging with yup validation to be really easy peasy. That being said, this will likely need to be ported so that the new filters can use it. Might want to get https://github.com/coforma/swift-tech-challenge/pull/169 in first.

Type of change

How To Test

Checklist:

ntsummers1 commented 5 months ago

Overall looks good to me. Do Formik and react-hook-form play nicely? How does USWDSForm help as well?

So Formik is a replacement for react-hook-form. We should use one or the other, and Formik comes with Yup integration so you don't need a 3rd party to hook up react-hook-form to yup. Also, its much lighter which is a plus.

USWDS form is a form wrapper, so you can put whatever fields you want inside of it and it'll contain it. I've used it here so that it can wrap and control the modal form's filters as well as the application form all using the same code. Pretty slick!

codeclimate[bot] commented 5 months ago

Code Climate has analyzed commit d90cc5c6 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 88.6% (80% is the threshold).

This pull request will bring the total coverage in the repository to 86.4% (0.3% change).

View more on Code Climate.