Skip to content

Commit

Permalink
fix(tag): implement tag fixes (font-weight, required) (#1727)
Browse files Browse the repository at this point in the history
* fix(tag): implement tag fixes (font-weight, required)

This change fixes two issues:

1. tags should now have a bold font weight
2. consumers should be able to custom theme the required variant

It also includes updates to the docs outlining available theme variables

* regenerate visual tests; test custom theming

* Remove excess whitespace

* formatting

* update (post-summary) test images

they have tags in them
  • Loading branch information
dancormier authored May 3, 2024
1 parent 706c4b4 commit 919dde5
Show file tree
Hide file tree
Showing 363 changed files with 785 additions and 682 deletions.
6 changes: 0 additions & 6 deletions docs/product/foundation/theming.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,12 @@ <h3>{{ set.name | capitalize }}</h3>
--theme-tag-hover-background-color
--theme-tag-hover-border-color
--theme-tag-hover-color
--theme-tag-selected-background-color
--theme-tag-selected-border-color
--theme-tag-selected-color
--theme-tag-required-background-color
--theme-tag-required-border-color
--theme-tag-required-color
--theme-tag-required-hover-background-color
--theme-tag-required-hover-border-color
--theme-tag-required-hover-color
--theme-tag-required-selected-background-color
--theme-tag-required-selected-border-color
--theme-tag-required-selected-color
--theme-topbar-accent-border
--theme-topbar-background-color
--theme-topbar-bottom-border
Expand Down
9 changes: 7 additions & 2 deletions lib/components/tag/tag.less
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@
}

&&__required:not(&__moderator) {
--_ta-bc: var(--black-400);
--_ta-bc-hover: var(--black-600);
--_ta-bc: var(--theme-tag-required-border-color, var(--theme-tag-border-color, var(--black-400)));
--_ta-bg: var(--theme-tag-required-background-color, var(--theme-tag-background-color, var(--black-150)));
--_ta-fc: var(--theme-tag-required-color, var(--theme-tag-color, var(--black-500)));
--_ta-bc-hover: var(--theme-tag-required-hover-border-color, var(--theme-tag-hover-border-color, var(--black-600)));
--_ta-bg-hover: var(--theme-tag-required-hover-background-color, var(--theme-tag-hover-background-color, var(--black-200)));
--_ta-fc-hover: var(--theme-tag-required-hover-color, var(--theme-tag-hover-color, var(--black-600)));
}

&__watched, // TODO: remove all single `&` watched styles once core no longer requires them
Expand Down Expand Up @@ -173,6 +177,7 @@

align-items: center;
display: inline-flex;
font-weight: 700;
justify-content: center;
min-width: 0;
text-decoration: none;
Expand Down
36 changes: 34 additions & 2 deletions lib/components/tag/tag.visual.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@ const children = {
sponsor: `<img class="s-tag--sponsor" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII" width="16" height="16" alt="sponsor">sponsor`,
};

const themeStyles = `
--theme-tag-background-color: var(--purple-100);
--theme-tag-border-color: var(--purple-100);
--theme-tag-color: var(--purple-500);
--theme-tag-required-background-color: var(--green-100);
--theme-tag-required-border-color: var(--green-400);
--theme-tag-required-color: var(--green-500);
`;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const template = ({ component, testid }: any) => html`
<div data-testid="${testid}" class="d-inline-block p4">${component}</div>
const template = ({ component, testid, style = "" }: any) => html`
<div data-testid="${testid}" class="d-inline-block p4" style="${style}">
${component}
</div>
`;

describe("tag", () => {
Expand All @@ -36,4 +47,25 @@ describe("tag", () => {
includeNullModifier: false,
},
});

// Custom theme variables
runVisualTests({
baseClass: "s-tag",
variants: ["required"],
modifiers: {
global: ["custom-theme"], // added for test id purposes
},
children: {
default: children.default,
},
template: ({ component, testid }) =>
template({
component,
testid,
style: themeStyles,
}),
options: {
includeNullModifier: false,
},
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions screenshots/Chromium/baseline/s-tag-dark-custom-theme.png
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-tag-dark-dismiss.png
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-tag-dark-ignored-dismiss.png
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-tag-dark-ignored-sponsor.png
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-tag-dark-ignored.png
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-tag-dark-lg.png
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-tag-dark-md.png
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-tag-dark-moderator.png
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-tag-dark-required-dismiss.png
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-tag-dark-required-sponsor.png
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-tag-dark-required.png
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-tag-dark-sm.png
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-tag-dark-sponsor.png
Loading

0 comments on commit 919dde5

Please sign in to comment.