Skip to content
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

WIP: Simplifies and improves table backgrounds #24660

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 20 additions & 3 deletions scss/_tables.scss
Expand Up @@ -70,6 +70,13 @@
.table-striped {
tbody tr:nth-of-type(odd) {
background-color: $table-accent-bg;
/* stylelint-disable */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andresgalante: please be more explicit with what you disable here.

// disables qualifying type selector
// This selector is required to override `.table-striped`
&.table-active {
background-color: $table-active-bg;
}
/* stylelint-enable */
}
}

Expand All @@ -89,14 +96,12 @@

// Table backgrounds
//
// Exact selectors below required to override `.table-striped` and prevent
// inheritance to nested tables.

@each $color, $value in $theme-colors {
@include table-row-variant($color, theme-color-level($color, -9));
}

@include table-row-variant(active, $table-active-bg);
.table-active { background-color: $table-active-bg; }


// Dark styles
Expand Down Expand Up @@ -139,6 +144,13 @@
&.table-striped {
tbody tr:nth-of-type(odd) {
background-color: $table-dark-accent-bg;
/* stylelint-disable */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and here.

// disables qualifying type selector
// This selector is required to override `.table-striped`
&.table-active {
background-color: $table-dark-active-bg;
}
/* stylelint-enable */
}
}

Expand All @@ -149,6 +161,11 @@
}
}
}

&.table-active,
.table-active {
background-color: $table-dark-active-bg;
}
}


Expand Down
2 changes: 1 addition & 1 deletion scss/_variables.scss
Expand Up @@ -312,7 +312,7 @@ $table-dark-accent-bg: rgba($white, .05) !default;
$table-dark-hover-bg: rgba($white, .075) !default;
$table-dark-border-color: lighten($gray-900, 7.5%) !default;
$table-dark-color: $body-bg !default;

$table-dark-active-bg: $table-dark-hover-bg !default;

// Buttons + Forms
//
Expand Down
13 changes: 6 additions & 7 deletions scss/mixins/_table-row.scss
@@ -1,14 +1,13 @@
// Tables

@mixin table-row-variant($state, $background) {
// Exact selectors below required to override `.table-striped` and prevent
// inheritance to nested tables.
.table-#{$state} {
&,
> th,
> td {
background-color: $background;
}
background-color: $background;
}

// This selector is required to override `.table-striped`
.table-striped tbody tr:nth-of-type(odd).table-#{$state} {
background-color: $background;
}

// Hover states for `.table-hover`
Expand Down