refactor(labware-creator): split apart sections into separate components #7735
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR splits the first three sections (create new definition, upload existing, and regularity) into their own components.
Each section component is responsible for getting formik values for displaying errors via
useFormikContext
. Each new section we make can take advantage of the functiongetFormAlerts
that takes formik props and returns all relevant errors that should be displayed. SeeCreateNewDefinition
andRegularity
for how to use it.New sections should also use the
SectionBody
UI component to format content + alerts (this was extracted from the oldSection
component). Again seeCreateNewDefinition
andRegularity
for how to use it.I was bad and did not include test coverage here (soon to come!). In future PRs breaking out sections let's please take the time to add test coverage (preferably using testing library). In the next PR I'll have a few tests to serve as an example.
Partially addresses #7707
Changelog
Review requests
Smoke test to see if things still work, code review
Risk assessment
Low/Medium