-
Notifications
You must be signed in to change notification settings - Fork 1
feat(Formbot): support for yup via validationSchema; Add Context provider and EasyInput consumer #20
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20 +/- ##
=======================================
Coverage 71.91% 71.91%
=======================================
Files 12 12
Lines 146 146
Branches 19 19
=======================================
Hits 105 105
Misses 31 31
Partials 10 10 Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #20 +/- ##
=======================================
Coverage 71.91% 71.91%
=======================================
Files 12 12
Lines 146 146
Branches 19 19
=======================================
Hits 105 105
Misses 31 31
Partials 10 10 Continue to review full report at Codecov.
|
Let's add docz example using yup |
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.
I'm getting an error:
"TypeError: this.validatable.map is not a function[Learn More]"
Do we need to add something like this? Or am I doing something wrong?
constructor(props) {
this.validatable = [];
}
src/index.js
Outdated
@@ -16,6 +16,7 @@ export Flex from './Flex'; | |||
export Formbot from './Form/Formbot'; | |||
export FormError from './Form/FormError'; | |||
export FormGroup from './Form/FormGroup'; | |||
export FieldSet from './Form/FormGroup'; |
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.
Fieldset
should be an entirely new component. FormGroups refer to https://getbootstrap.com/docs/4.0/components/forms/#form-groups which adds bottom margin to adjacent inputs
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.
added but FieldSet
does something similar in the presence of adjacent elements - unclear how one would mix usage of FieldSet
and FormGroup
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.
hm also web-app
has a different FieldSet
which has a sublegend and is styled differently - should we leave them as is or theme FieldSet
s?
theres also i can ship this as is and update the EMR and we can do a second pass to clean up the web-app next hack day |
Supernit: Can we rename FieldSet to Fieldset? HTML tag reads
Our FormGroup and Field are very similar. Most (should be all) of our input components are wrapped in Fieldset is used for optionally grouping related fields if multiple sets exist and conventionally has the The css class <Form>
<Fieldset legend="Some group of fields">
<Input />
<Input /> {/* Here we have adjacent Fields so this one has a top margin applied */}
</Fieldset>
<Fieldset legend="Some other group of fields">
<FormGroup>
<Row>
<Col>
<Input />
</Col>
<Col>
<Input />
</Col>
</Row>
</FormGroup>
</Fieldset>
<Button type="submit" />
</Form>
This is the right call. |
@kylealwyn looks like const FormGroup = ({ children, padding = 3 }) => <Box mb={padding}>{children}</Box>; |
@choochootrain sorry, only using bootstrap class as reference for why it exists |
@sappira-inc/engineering take a look at the last change, i'm open to suggestions |
yup
schemas for validation:pulled from EMR
Formbot
-validationSchema
takes precedence overvalidations
Inputs
withinFormbot
context:see Add Context to Formbot with EasyInput consumer and HOC #21 for details
Fieldset
component:pulled from EMR