Skip to content

Commit

Permalink
fix: tup-659 all form fields too short (#267)
Browse files Browse the repository at this point in the history
* fix: tup-659 all form fields too short

1. Remove field width stretch from CMS and Login.
2. Add field width stretch to all forms.
3. Support form width stretch only if NOT a checkbox.

* fix: tup-659 simplify solution

No need to avoid stretching fieldw rapper that has a checkbox.

A checkbox (and others) are already explicitely told not to stretch.

* refactor: revert unrelated changes
  • Loading branch information
wesleyboar authored Nov 21, 2023
1 parent e7349b3 commit 793c441
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 22 deletions.
2 changes: 1 addition & 1 deletion dist/components/c-form--login.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/components/c-form.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/components/django-cms-forms.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-styles.base.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/trumps/s-form--login.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/trumps/s-form.css

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions src/lib/_imports/components/c-form--login.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@
display: none;
}

/* To make elements bigger */
& :--form__field:not(:--form__field--has-checkbox) {
/* To stretch input field width */
display: flex;
flex-direction: column;
}
/* To always use larger field inputs (not just on coarse pointer devices) */
& input {
padding: 12px 12px; /* mimic Core Styles forms.css @media (pointer: coarse) */
Expand Down
3 changes: 3 additions & 0 deletions src/lib/_imports/components/c-form.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@

:--form__field {
margin-bottom: 2rem; /* mimic <p> `margin-bottom` */

display: flex;
flex-direction: column;
}

:--form__field--has-checkbox {
Expand Down
13 changes: 3 additions & 10 deletions src/lib/_imports/components/django-cms-forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
/* SEE ../components/c-form.css */
/* SEE: ../tools/selectors.form.css */

@custom-selector :--cms-form__field--no-checkbox
.field-wrapper:where(:not(.checkboxinput));

:--cms-form__field--no-checkbox {
display: flex;
flex-direction: column;
width: max-content;
}
:--cms-form__field--no-checkbox > .field-errors { order: 1; }
:--cms-form__field--no-checkbox > .help-text { order: 2; }
/* To ensure */
:--cms-form__field > :--cms-form__errors { order: 1; }
:--cms-form__field > :--cms-form__help { order: 2; }

0 comments on commit 793c441

Please sign in to comment.