Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit a7f4d0e

Browse files
Make loading placeholder colors match the current font color (#7658)
* Make loading placeholder colors match the current font color Currently, the loading placeholder effect has a default gray color. However, since users can modify their themes with the Site Editor and choose a different set of colors for their websites, it would be interesting to make those placeholders match the color palette. In this commit, the idea was to modify the `placeholder` mixin to replace the transparent font color with the current color and also modify the background-color and the linear-gradient to match the current font color. Furthermore, transparency was added to the middle color of the linear-gradient so we can keep the loading animation close to what it currently is. * Add opacity to placeholder mixin Before our changes, when the font color was dark, we had a lighter placeholder background color. After the changes the color is currently darker than before so the idea for this commit is to change the opacity of the placeholder in a way that the current color blends with the background color set for the theme. * Change placeholder mixin opacity After testing different combinations of colors, we decided to change the opacity to 0.15 so when the font color is darker the placeholder will have a lighter background color. * bot: update checkstyle.xml Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 74dd439 commit a7f4d0e

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

assets/css/abstracts/_mixins.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ $fontSizes: (
3232
@mixin placeholder($include-border-radius: true) {
3333
outline: 0 !important;
3434
border: 0 !important;
35-
background-color: #ebebeb !important;
36-
color: transparent !important;
35+
background-color: currentColor !important;
36+
color: currentColor !important;
3737
width: 100%;
3838
@if $include-border-radius == true {
3939
border-radius: 0.25rem;
@@ -46,6 +46,7 @@ $fontSizes: (
4646
pointer-events: none;
4747
box-shadow: none;
4848
z-index: 1; /* Necessary for overflow: hidden to work correctly in Safari */
49+
opacity: 0.15;
4950

5051
// Forces direct descendants to keep layout but lose visibility.
5152
> * {
@@ -61,7 +62,7 @@ $fontSizes: (
6162
top: 0;
6263
height: 100%;
6364
background-repeat: no-repeat;
64-
background-image: linear-gradient(90deg, #ebebeb, #f5f5f5, #ebebeb);
65+
background-image: linear-gradient(90deg, currentColor, #f5f5f54d, currentColor);
6566
transform: translateX(-100%);
6667
animation: loading__animation 1.5s ease-in-out infinite;
6768
}

assets/js/base/components/filter-placeholder/style.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
.wc-block-filter-title-placeholder {
22
@include placeholder();
3-
background-color: $gray-400 !important;
43
border-radius: em(26px);
54
box-shadow: none;
65
min-width: 80px;
76
margin-top: $gap-small;
87
margin-bottom: $gap-small;
98
max-width: max-content !important;
109

11-
&::after {
12-
background-image: linear-gradient(90deg, $gray-400, $gray-200, $gray-400);
13-
}
14-
1510
.wc-block-stock-filter__title,
1611
.wc-block-price-filter__title,
1712
.wc-block-active-filters__title,

checkstyle.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,9 +1419,6 @@
14191419
Type &apos;Readonly&lt;{}&gt;&apos; is not assignable to type &apos;Record&lt;string, unknown&gt; &amp; { className: string; }&apos;.
14201420
Property &apos;className&apos; is missing in type &apos;Readonly&lt;{}&gt;&apos; but required in type &apos;{ className: string; }&apos;." source="TS2322" />
14211421
</file>
1422-
<file name="assets/js/atomic/blocks/product-elements/stock-indicator/edit.js">
1423-
<error line="15" column="18" severity="error" message="Binding element &apos;attributes&apos; implicitly has an &apos;any&apos; type." source="TS7031" />
1424-
</file>
14251422
<file name="assets/js/atomic/blocks/product-elements/add-to-cart/edit.js">
14261423
<error line="25" column="18" severity="error" message="Binding element &apos;attributes&apos; implicitly has an &apos;any&apos; type." source="TS7031" />
14271424
<error line="25" column="30" severity="error" message="Binding element &apos;setAttributes&apos; implicitly has an &apos;any&apos; type." source="TS7031" />

0 commit comments

Comments
 (0)