-
Notifications
You must be signed in to change notification settings - Fork 1.1k
USWDS - Table: Update color styles to use theme settings #4712
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
Changes from 1 commit
0674506
9736b53
0388b80
2ea67b1
29523d9
7cc6fb0
a36ad60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,13 +5,12 @@ | |
| @use "../utilities" as *; | ||
| @use "../typography/typeset" as *; | ||
|
|
||
| $table-text-color: color( | ||
| get-color-token-from-bg( | ||
| $bg-color: $theme-body-background-color, | ||
| $preferred-text-token: $theme-text-reverse-color, | ||
| $fallback-text-token: $theme-table-text-color, | ||
| $context: "Table text", | ||
| ) | ||
|
|
||
| $table-text-color: get-color-token-from-bg( | ||
| $bg-color: $theme-body-background-color, | ||
| $preferred-text-token: $theme-text-reverse-color, | ||
| $fallback-text-token: $theme-table-text-color, | ||
|
||
| $context: "Table text", | ||
| ); | ||
|
|
||
| $table-header-text-color: color( | ||
|
|
@@ -59,6 +58,22 @@ $table-sorted-stripe-text-color: color( | |
| ) | ||
| ); | ||
|
|
||
| $table-sorted-icon-color: color( | ||
| get-color-token-from-bg( | ||
| $bg-color: $theme-table-sorted-header-background-color, | ||
| $preferred-text-token: $theme-table-sorted-icon-color, | ||
| $fallback-text-token: $theme-table-unsorted-icon-color, | ||
| $context: "Table sorted icon", | ||
| ) | ||
| ); | ||
|
|
||
| $table-unsorted-icon-color: get-color-token-from-bg( | ||
| $bg-color: $theme-table-header-background-color, | ||
| $preferred-text-token: $theme-table-unsorted-icon-color, | ||
| $fallback-text-token: $theme-text-color, | ||
| $context: "Table unsorted icon", | ||
| ); | ||
|
|
||
| // Shared table styles | ||
| @mixin table-header-unsorted-styles { | ||
| padding-right: units(5); | ||
|
|
@@ -107,24 +122,26 @@ $table-sorted-stripe-text-color: color( | |
| @mixin table-button-unsorted-styles { | ||
| @include table-button-default-styles; | ||
| .usa-icon > g.unsorted { | ||
| fill: color($theme-table-unsorted-icon-color); | ||
| fill: color( | ||
| next-token($table-unsorted-icon-color, "lighter") | ||
| ) | ||
| } | ||
| &:hover .usa-icon > g.unsorted { | ||
| fill: $table-sorted-header-text-color; | ||
| fill: color($table-unsorted-icon-color); | ||
| } | ||
| } | ||
|
|
||
| @mixin table-button-sorted-ascending-styles { | ||
| @include table-button-default-styles; | ||
| .usa-icon > g.ascending { | ||
| fill: $table-sorted-header-text-color; | ||
| fill: $table-sorted-icon-color; | ||
| } | ||
| } | ||
|
|
||
| @mixin table-button-sorted-descending-styles { | ||
| @include table-button-default-styles; | ||
| .usa-icon > g.descending { | ||
| fill: $table-sorted-header-text-color; | ||
| fill: $table-sorted-icon-color; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -203,7 +220,7 @@ $table-sorted-stripe-text-color: color( | |
| @include typeset; | ||
| border-collapse: collapse; | ||
| border-spacing: 0; | ||
| color: $table-text-color; | ||
| color: color($table-text-color); | ||
| margin: units(2.5) 0; | ||
| text-align: left; | ||
|
|
||
|
|
@@ -294,16 +311,22 @@ $table-sorted-stripe-text-color: color( | |
| th { | ||
| background-color: transparent; | ||
| border-top: 0; | ||
| color: $table-text-color; | ||
| color: color($table-text-color); | ||
|
|
||
| &[aria-sort] { | ||
| color: $table-sorted-header-text-color; | ||
| } | ||
| } | ||
| /* stylelint-disable selector-class-pattern */ | ||
| th[data-sortable]:not([aria-sort]) { | ||
| .usa-table__header__button .usa-icon > g.unsorted { | ||
| fill: color( | ||
| next-token($table-text-color, "lighter") | ||
| ); | ||
| } | ||
|
|
||
| .usa-table__header__button:hover .usa-icon > g.unsorted { | ||
| fill: $table-text-color; | ||
| fill: color($table-text-color); | ||
| } | ||
| } | ||
| /* stylelint-enable selector-class-pattern */ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the color function here so that we could use this variable with
next-token()below for hover states