Skip to content

Commit

Permalink
Prep Tailwind CSS migration part 6 (#8139)
Browse files Browse the repository at this point in the history
* Add form errors and hints for UI dev

* Use antialiased text on body

* Add radio styles, set base for form controls

* Disable old form SCSS styles

* Add form styles

* Remove old fieldset inputs style

* Remove comment-form fieldset inputs style

This is no longer needed now since we removed the initial selector that added default padding.

* Increase input vertical spacing from 2.5 to 3

Since this adds top and bottom padding, this would be the equal spacing as using gap-6 but using spacing around the container. The overall spacing here is nicer and easier to call out the grouped inputs.

* Add explicit filters, use check_boxes

We need more variety for UI testing so some of these filters instead of select's use check boxes instead.

* Update filter form label style

Use the label class here so when using check boxes for a filter, this only applies to the filter label (group), not the label for each checkbox.

* Remove hard coded space from filter checkbox input

* Add filter form checkboxes style

* Use consistent Sign-In/Out language

This changes "Login" text to "Sign in". We have other places in the locale (links) where we actually use "Sign in" so we should stay consistent. Also apparent with "Log out" instead of "Sign out". Devise is consistent with using both "sign in/out" in its messages so we should be consistent as well.

* Disable old main structure styles

* Add default viewport meta tag for mobile support

Using latest value per HTML5 Boilerplate

https://github.com/h5bp/html5-boilerplate/blob/main/src/index.html

* Permit ngrok-free.app in dev hosts

This is helpful when testing the local dev app on a mobile device.

* Update date input pseudo styles

This resolves a few issues with date inputs on Mac and iOS.

Defaults to left alignment (inherit).

tailwindlabs/tailwindcss-forms#144

Removes top and bottom padding on each of the datetime edit fields so with this the field will now match the same height as other inputs.

tailwindlabs/tailwindcss-forms#146

tailwindlabs/tailwindcss-forms#95

tailwindlabs/tailwindcss-forms#109

* Increase footer top margin

* Remove panel from show page attributes_table

This is redundant with the page title above it. Common to see admins without this redundant title. This makes it better as a default and also to accommodate others that want to customize the layout.

* Devise pages and form actions styles

The form actions styles overlapped with the Devise page updates so I've applied these here. The login button (and for other Devise pages) is full width but because of Formtastic's semantic structure, the actions were laid out horizontally using flex. We only apply flex now if there are multiple actions. This way, on the Devise pages, the action can go full width.

* Update create-another checkbox styles

I prefer the original input+label layout but since Formtastic enforces the nested input within label which we already have styled (despite it being more problematic) this now looks much better.

* Remove columns component

I've decided that there is no point in keeping this and with the move to making the admin more mobile friendly, its just all around easier to replace these with div's and Tailwind classes for the right columns at the right viewport.

* Update blank_slate component

Now just a simple div component with a default CSS class. The content provided can be anything now and isn't built using html_safe, unless given in that form.

* Always use grid for page content container

Even if it's a single column, we always want to use grid here so we can apply the gap if a sidebar is added which is conditional.

* Update templates with Tailwind classes

* Set table actions default style

Easiest to just space these out at the container level for a suitable default.

* Update dropdown styles

This sets the list to a min full width which will at least match the size of the button if the list content is shorter which is often the case with our defaults.

Add a larger shadow to separate popup from content underneath.

Add text color styles to offset the default anchor color.

* Add filter with combined ransack predicate

* Disable more SASS partials that have been migrated

* Disable breadcrumbs SASS (migrated)

This includes an update to a feature test because it was using an old CSS class name for a negated test.

* Disable sortable handle

This no longer works since we removed jQuery UI. Our upgrade guide will call out that has-many-sortable isn't implemented in v4 and will require community contribution.

* Add has-many form styles

* Disable forms SASS partial completely

This has been fully migrated now. From here we can remove sass all together.
  • Loading branch information
javierjulio committed Nov 30, 2023
1 parent ccdf0d7 commit c0d31cd
Show file tree
Hide file tree
Showing 40 changed files with 489 additions and 562 deletions.
24 changes: 12 additions & 12 deletions app/assets/stylesheets/active_admin/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

// Partials
// @import "./typography";
@import "./header";
@import "./forms";
// @import "./header";
// @import "./forms";
// @import "./components/comments";
@import "./components/flash_messages";
// @import "./components/flash_messages";
// @import "./components/date_picker";
@import "./components/tables";
@import "./components/batch_actions";
@import "./components/modal_dialog";
@import "./components/blank_slates";
@import "./components/breadcrumbs";
// @import "./components/tables";
// @import "./components/batch_actions";
// @import "./components/modal_dialog";
// @import "./components/blank_slates";
// @import "./components/breadcrumbs";
// @import "./components/dropdown_menu";
// @import "./components/buttons";
// @import "./components/links";
Expand All @@ -23,12 +23,12 @@
// @import "./components/scopes";
// @import "./components/status_tags";
// @import "./components/table_tools";
@import "./components/index_list";
// @import "./components/index_list";
// @import "./components/tabs";
@import "./pages/logged_out";
// @import "./pages/logged_out";
// @import "./structure/footer";
@import "./structure/main_structure";
@import "./structure/title_bar";
// @import "./structure/main_structure";
// @import "./structure/title_bar";

// html {
// box-sizing: border-box;
Expand Down
288 changes: 144 additions & 144 deletions app/assets/stylesheets/active_admin/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@ form {
// ol, ul { list-style: none }

fieldset {
border: 0;
padding: 10px 0;
margin-bottom: 20px;
// border: 0;
// padding: 10px 0;
// margin-bottom: 20px;

// &.inputs { @include section-background; }

legend {
width: 100%;
span { display: block; @include section-header; }
}
// legend {
// width: 100%;
// span { display: block; @include section-header; }
// }

ol > li {
padding: 10px;
label {
display: block;
width: 20%;
float: left;
font-size: 1.0em;
font-weight: bold;
color: $form-label-color;
abbr {
border: none;
color: $required-field-marker-color;
}
}
}
// ol > li {
// padding: 10px 0;
// label {
// display: block;
// width: 20%;
// float: left;
// font-size: 1.0em;
// font-weight: bold;
// color: $form-label-color;
// abbr {
// border: none;
// color: $required-field-marker-color;
// }
// }
// }

ol > li.has_many_container {
padding: 20px 10px;
Expand Down Expand Up @@ -79,31 +79,31 @@ form {

/* Nested Fieldsets and Legends */

fieldset > ol > li {
fieldset {
position:relative;
padding: 0;
margin-bottom: 0;

&:not(.inputs) ol {
float: left;
width: 74%;
margin: 0;
padding: 0 0 0 20%;

li {
padding: 0;
border: 0;
}
}

&.inputs ol {
float: left;
width: 100%;
margin: 0;
}
}
}
// fieldset > ol > li {
// fieldset {
// position:relative;
// padding: 0;
// margin-bottom: 0;

// &:not(.inputs) ol {
// float: left;
// width: 74%;
// margin: 0;
// padding: 0 0 0 20%;

// li {
// padding: 0;
// border: 0;
// }
// }

// &.inputs ol {
// float: left;
// width: 100%;
// margin: 0;
// }
// }
// }

/* Text Fields */
// input[type=text],
Expand Down Expand Up @@ -136,86 +136,86 @@ form {
fieldset > ol > li {

/* Hints */
p.inline-hints {
font-size: 0.95em;
font-style: italic;
color:#666;
margin: 0.5em 0 0 20%;
}
// p.inline-hints {
// font-size: 0.95em;
// font-style: italic;
// color:#666;
// margin: 0.5em 0 0 20%;
// }

/* Date and Time Fields */
&.date_select, &.time_select, &.datetime_select {
fieldset ol li {
float:left; width:auto; margin:0 0.5em 0 0;
label { display: none; }
input { display:inline; margin:0; padding:0; }
}
}
// &.date_select, &.time_select, &.datetime_select {
// fieldset ol li {
// float:left; width:auto; margin:0 0.5em 0 0;
// label { display: none; }
// input { display:inline; margin:0; padding:0; }
// }
// }

/* Check Boxes or Radio fields */
&.check_boxes, &.radio {
fieldset ol {
margin-bottom:-0.6em;
li {
margin:0.1em 0 0.5em 0;
label {
float:none;
width:100%;
input { margin-right:0.2em; }
}
}
}
}
// &.check_boxes, &.radio {
// fieldset ol {
// margin-bottom:-0.6em;
// li {
// margin:0.1em 0 0.5em 0;
// label {
// float:none;
// width:100%;
// input { margin-right:0.2em; }
// }
// }
// }
// }

/* Boolean Field */
&.boolean {
min-height: 1.1em;
label {
width: 100%;
padding-left:20%;
padding-right: 10px;
text-transform: none !important;
font-weight: normal;
input { margin:0 0.5em 0 0.2em; }
}
}
// &.boolean {
// min-height: 1.1em;
// label {
// width: 100%;
// padding-left:20%;
// padding-right: 10px;
// text-transform: none !important;
// font-weight: normal;
// input { margin:0 0.5em 0 0.2em; }
// }
// }

/* Hidden fields */
&.hidden {
padding: 0;
}
// &.hidden {
// padding: 0;
// }

/* Errors */
p.inline-errors {
color: $error-color;
font-weight: bold;
margin:0.3em 0 0 20%;
}
ul.errors {
color: $error-color;
margin:0.5em 0 0 20%;
list-style:square;
li { padding:0; border:none; display:list-item; }
}
// p.inline-errors {
// color: $error-color;
// font-weight: bold;
// margin:0.3em 0 0 20%;
// }
// ul.errors {
// color: $error-color;
// margin:0.5em 0 0 20%;
// list-style:square;
// li { padding:0; border:none; display:list-item; }
// }

&.error {
input[type=text], input[type=password], input[type=email], input[type=number], input[type=url], input[type=tel], textarea {
border: $border-width solid $error-color;
}
}
// &.error {
// input[type=text], input[type=password], input[type=email], input[type=number], input[type=url], input[type=tel], textarea {
// border: $border-width solid $error-color;
// }
// }
}

/* semantic_errors */
ul.errors {
background: lighten($error-color, 60%);
@include rounded(4px);
color: $error-color;
font-weight: bold;
margin-bottom: 10px;
padding: 10px;
list-style:square;
li { margin-left:15px; padding:0; border:none; display:list-item; }
}
// ul.errors {
// background: lighten($error-color, 60%);
// @include rounded(4px);
// color: $error-color;
// font-weight: bold;
// margin-bottom: 10px;
// padding: 10px;
// list-style:square;
// li { margin-left:15px; padding:0; border:none; display:list-item; }
// }

/* Buttons */

Expand All @@ -224,27 +224,27 @@ form {
// cursor: pointer;
// }

.buttons, .actions {
margin-top: 15px;
input[type=submit], input[type=button], button { margin-right: 10px; }
}
// .buttons, .actions {
// margin-top: 15px;
// input[type=submit], input[type=button], button { margin-right: 10px; }
// }

.actions .create_another {
float: none;
margin-bottom: 10px;
// .actions .create_another {
// float: none;
// margin-bottom: 10px;

label {
float: none;
display: inline;
}
}
// label {
// float: none;
// display: inline;
// }
// }

fieldset.buttons li, fieldset.actions li {
float:left;
padding: 0;
// fieldset.buttons li, fieldset.actions li {
// float:left;
// padding: 0;

&.cancel a { @include light-button; }
}
// &.cancel a { @include light-button; }
// }
}

// -------------------------------------- Sidebar Forms
Expand Down Expand Up @@ -287,20 +287,20 @@ form.filter_form {
// }
// }

&.filter_check_boxes {
label { margin-bottom: 3px; }
fieldset {
margin-bottom: 0px;
padding-bottom: 0px;
}
.check_boxes_wrapper label {
font-weight: normal;
margin-bottom: 3px;
text-transform: none;
font-size: 1.0em;
input { vertical-align: baseline; }
}
}
// &.filter_check_boxes {
// label { margin-bottom: 3px; }
// fieldset {
// margin-bottom: 0px;
// padding-bottom: 0px;
// }
// .check_boxes_wrapper label {
// font-weight: normal;
// margin-bottom: 3px;
// text-transform: none;
// font-size: 1.0em;
// input { vertical-align: baseline; }
// }
// }

// &.filter_date_range {
// input[type=text] {
Expand Down

0 comments on commit c0d31cd

Please sign in to comment.