Skip to content

Commit

Permalink
Update form styles in CMS when editing Elements
Browse files Browse the repository at this point in the history
The fields in e.g. 'split mode' editing within the CMS looked a bit
squished as the labels first took up an amount of room to the left of
the field proper. The better and desired approach here was to use the
.stacked class - rendering the labels atop the field.

However this approach would require every element built to add the
extraClass to the FormField instance in PHP in the getCMSFields method.
This is less than ideal, so it was decided to proceed with an override
for elements (and elements only) that will achieve the same effect.

Also addresses checkboxes and radio buttons where the label generally
sits on the other side of the input element, where .stacked does not.
  • Loading branch information
Dylan Wagstaff committed Oct 30, 2018
1 parent ada2505 commit 3da7903
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/dist/styles/bundle.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions client/src/styles/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,22 @@
left: 14px;
}
}

// Stack fields - this is a global default for all Elemental Areas
// doing it this way means people do not need to add 'stacked' as
// an extra class to all PHP CMS field definitions, and passing that
// through to React.
// This also means the selector needs to be a smidge silly specific.
.element-editor .form-group:nth-child(1n) {
display: block;

.form__field-label,
.form__field-holder {

@include media-breakpoint-up(lg) {
@include make-col(10);
// To bring checkboxes and radio buttons into alignment
margin-left: 0;
}
}
}

0 comments on commit 3da7903

Please sign in to comment.