-
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 all commits
0674506
9736b53
0388b80
2ea67b1
29523d9
7cc6fb0
a36ad60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,60 +5,66 @@ | |
| @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-table-text-color, | ||
| $context: "Table text", | ||
| ); | ||
|
|
||
| $table-header-text-color: color( | ||
| get-color-token-from-bg( | ||
| $bg-color: $theme-table-header-background-color, | ||
| $preferred-text-token: $theme-text-reverse-color, | ||
| $fallback-text-token: $theme-table-header-text-color, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved the theme settings variables into the value for |
||
| $preferred-text-token: $theme-table-header-text-color, | ||
| $context: "Table header text", | ||
| ) | ||
| ); | ||
|
|
||
| $table-stripe-text-color: color( | ||
| get-color-token-from-bg( | ||
| $bg-color: $theme-table-stripe-background-color, | ||
| $preferred-text-token: $theme-text-reverse-color, | ||
| $fallback-text-token: $theme-table-stripe-text-color, | ||
| $preferred-text-token: $theme-table-stripe-text-color, | ||
| $context: "Table stripe text", | ||
| ) | ||
| ); | ||
|
|
||
| $table-sorted-text-color: color( | ||
| get-color-token-from-bg( | ||
| $bg-color: $theme-table-sorted-background-color, | ||
| $preferred-text-token: $theme-text-reverse-color, | ||
| $fallback-text-token: $theme-table-text-color, | ||
| $context: "Table sorted text", | ||
| ) | ||
| ); | ||
|
|
||
| $table-sorted-header-text-color: color( | ||
| get-color-token-from-bg( | ||
| $bg-color: $theme-table-sorted-header-background-color, | ||
| $preferred-text-token: $theme-text-reverse-color, | ||
| $fallback-text-token: $theme-table-header-text-color, | ||
| $preferred-text-token: $theme-table-header-text-color, | ||
| $context: "Table sorted header text", | ||
| ) | ||
| ); | ||
|
|
||
| $table-sorted-stripe-text-color: color( | ||
| get-color-token-from-bg( | ||
| $bg-color: $theme-table-sorted-stripe-background-color, | ||
| $preferred-text-token: $theme-text-reverse-color, | ||
| $fallback-text-token: $theme-table-stripe-text-color, | ||
| $preferred-text-token: $theme-table-stripe-text-color, | ||
| $context: "Table sorted stripe text", | ||
| ) | ||
| ); | ||
|
|
||
| $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, | ||
| $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, | ||
| $context: "Table unsorted icon", | ||
| ); | ||
|
|
||
|
Comment on lines
+53
to
+66
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Run |
||
|
|
||
| // Shared table styles | ||
| @mixin table-header-unsorted-styles { | ||
| padding-right: units(5); | ||
|
|
@@ -107,24 +113,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($table-unsorted-icon-color); | ||
| } | ||
| &:hover .usa-icon > g.unsorted { | ||
| fill: $table-sorted-header-text-color; | ||
| fill: color( | ||
| next-token($table-unsorted-icon-color, "darker") | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| @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; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -141,7 +149,7 @@ $table-sorted-stripe-text-color: color( | |
| } | ||
|
|
||
| tr { | ||
| border-bottom: units(0.5) solid $table-text-color; | ||
| border-bottom: units(0.5) solid color($theme-table-border-color); | ||
| border-top-width: 0; | ||
| display: block; | ||
| width: 100%; | ||
|
|
@@ -159,7 +167,7 @@ $table-sorted-stripe-text-color: color( | |
| &:first-child { | ||
| th:first-child, | ||
| td:first-child { | ||
| border-top: units(0.5) solid $table-text-color; | ||
| border-top: units(0.5) solid color($theme-table-border-color); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -203,7 +211,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; | ||
|
|
||
|
|
@@ -232,7 +240,7 @@ $table-sorted-stripe-text-color: color( | |
| th, | ||
| td { | ||
| background-color: color($theme-body-background-color); | ||
| border: 1px solid $table-text-color; | ||
| border: 1px solid color($theme-table-border-color); | ||
| font-weight: fw("normal"); | ||
| padding: units(1) units(2); | ||
| } | ||
|
|
@@ -294,16 +302,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($table-text-color); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a default fill for unsorted icons to match the header color |
||
| } | ||
|
|
||
| .usa-table__header__button:hover .usa-icon > g.unsorted { | ||
| fill: $table-text-color; | ||
| fill: color( | ||
| next-token($table-text-color, "darker") | ||
| ); | ||
| } | ||
| } | ||
| /* stylelint-enable selector-class-pattern */ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -184,7 +184,7 @@ $theme-summary-box-link-color: default !default; | |
| $theme-summary-box-text-color: default !default; | ||
|
|
||
| // Table | ||
| $theme-table-border-color: default !default; | ||
| $theme-table-border-color: "ink" !default; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| $theme-table-header-background-color: "base-lighter" !default; | ||
| $theme-table-header-text-color: default !default; | ||
| $theme-table-stripe-background-color: "base-lightest" !default; | ||
|
|
||
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