-
Notifications
You must be signed in to change notification settings - Fork 6
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
Remove need for custom form-control CSS #572
Conversation
* Validation error styling for a utrecht-form-field and utrecht-form-fieldset * Content component customClass styling
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #572 +/- ##
==========================================
+ Coverage 71.04% 71.38% +0.33%
==========================================
Files 209 208 -1
Lines 4321 4316 -5
Branches 1173 1174 +1
==========================================
+ Hits 3070 3081 +11
+ Misses 1217 1201 -16
Partials 34 34
☔ View full report in Codecov by Sentry. |
* Added some pristine state stories & tests for hidden components * Updated zod story to use semantically correct component in favour of form-control div/styles to be deleted.
The class name is now set directly on the WYSIWYG container and the custom classes are applied as modifiers instead of standalone/ utility classes, allowing us to clean up our CSS. Additionally, design tokens (with backwards compatible fallbacks) are introduced for the theming of each content variant.
This wrapper was applied to the formio component node rendered by the vanilla formio renderer, and copied over (for vertical spacing reasons) to the React implementation of form field components. The UtrechtFormField and UtrechtFormFieldset components already act like a wrapper/container, and we've introduced a separate class name to manage the vertical spacing of components. For interop with formio, we do some CSS/SASS extension gymnastics, which we'll be able to remove once we have our own React-based formio renderer.
dee6ae9
to
333d0af
Compare
Marked ready for review to get visual regression testing, this is by no means complete 😅 AKA "Chromatic take the wheel" |
0750427
to
7ac058d
Compare
f4da9f6
to
678a20a
Compare
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.
Also check the questions on Chromatic
@@ -13,7 +13,7 @@ export const LabelContent = ({id, disabled = false, isRequired = false, type, ch | |||
htmlFor={id} | |||
disabled={disabled} | |||
className={classNames({ | |||
'utrecht-form-label--openforms-required': isRequired, | |||
'utrecht-form-label--openforms-required': isRequired && requiredFieldsWithAsterisk, |
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 expected this fix to trigger a diff in chromatic.
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.
we didn't really have any stories with validate.required
or the explicit config to not use asterisks for required fields, so it makes sense there's no diff.
Or do you mean markup diffs?
Closes #571
Goal: getting rid of custom CSS for the form-control wrapper, which is arguably already performed by the
utrecht-form-field
component.There are some challenges, in particular because formio requires the
ref="component"
to be present and still applying the relevant styles & design tokens.