Skip to content

Commit

Permalink
[tofix] Align row headers with input contents
Browse files Browse the repository at this point in the history
tofix: the variable wasn't working fr some reason.

Inputs add extra padding, so we add the same padding to the header. Using an opt-in class, because I think we won't want this on all columns.
  • Loading branch information
dacook committed Aug 8, 2023
1 parent 5af8d9e commit 862114c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/views/admin/products_v3/_table.html.haml
Expand Up @@ -22,7 +22,7 @@
%col{ width:"5%", style: "max-width:5em" }
%thead
%tr
%th.align-left= t('admin.products_page.columns.name')
%th.align-left.with-input= t('admin.products_page.columns.name')
%th.align-right= t('admin.products_page.columns.sku')
%th.align-right= t('admin.products_page.columns.unit')
%th.align-right= t('admin.products_page.columns.price')
Expand Down
6 changes: 6 additions & 0 deletions app/webpacker/css/admin/products_v3.scss
Expand Up @@ -23,6 +23,12 @@
padding: 4px;
border-collapse: separate; // This is needed for the outer padding. Also should be helpful to give more flexibility of borders between rows.

// Additional horizontal padding to align with input contents
thead th.with-input {
padding-left: $padding-tbl-cell + $hpadding-txt;
padding-right: $padding-tbl-cell + $hpadding-txt;
}

// Row hover
tr:hover {
td {
Expand Down
2 changes: 1 addition & 1 deletion app/webpacker/css/admin/shared/forms.scss
Expand Up @@ -8,7 +8,7 @@ input[type="number"],
textarea,
fieldset {
@include border-radius($border-radius);
padding: 7px 10px;
padding: 7px 10px; //TODO: use $vpadding-txt $hpadding-text;
border: 1px solid $color-txt-brd;
color: $color-txt-text;
font-size: 90%;
Expand Down
7 changes: 5 additions & 2 deletions app/webpacker/css/admin_v3/globals/variables.scss
Expand Up @@ -33,7 +33,7 @@ $color-tbl-cell-shadow: rgb(0, 0, 0, 0.15) !default;
$color-tbl-thead-txt: $color-headers !default;
$color-tbl-thead-bg: $light-grey !default;
$color-tbl-border: $pale-blue !default;
$padding-tbl-cell: 12px 12px;
$padding-tbl-cell: 12px;
$padding-tbl-cell-condensed: 10px 12px;
$padding-tbl-cell-relaxed: 16px 12px;

Expand Down Expand Up @@ -70,10 +70,13 @@ $color-sel-text: $white !default;
$color-sel-hover-bg: lighten($color-sel-bg, 2) !default;
$color-sel-hover-text: $white !default;

// Text inputs colors
// Text inputs styles
$color-txt-brd: $color-border !default;
$color-txt-text: $near-black !default;
$color-txt-hover-brd: $teal !default;
$vpadding-txt: 7px;
$hpadding-txt: 10px;
$padding-txt: $vpadding-txt $hpadding-txt;

// Modal colors
$color-modal-close-btn: $color-5 !default;
Expand Down

0 comments on commit 862114c

Please sign in to comment.