Skip to content

Commit

Permalink
fix(Tile): update conditions to show/hide gradient
Browse files Browse the repository at this point in the history
  • Loading branch information
ImCoolNowRight committed Jan 9, 2024
1 parent e983f17 commit eaf21c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions packages/@lightningjs/ui-components/src/components/Tile/Tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ export default class Tile extends Surface {
get _gradient() {
if (this._isCircleLayout) return false;
return Boolean(
this._isInsetMetadata && this._hasMetadata && this._shouldShowMetadata
(this._isInsetMetadata &&
this._hasMetadata &&
this._shouldShowMetadata) ||
this.progressBar?.progress > 0 ||
this._shouldShowLogo
);
}

Expand Down Expand Up @@ -196,12 +200,12 @@ export default class Tile extends Surface {
w: this.style.logoWidth,
h: this.style.logoHeight,
icon: this.logo,
alpha: this.style.alpha,
alpha: this._shouldShowLogo ? this.style.alpha : 0.001,
x: this.style.paddingX,
y: this._calculateLogoYPosition()
};

if (this.logo && (this.persistentMetadata || this._isFocusedMode)) {
if (this._shouldShowLogo) {
if (!this._Logo) {
this.patch({
Logo: {
Expand All @@ -213,7 +217,7 @@ export default class Tile extends Surface {
} else {
this.applySmooth(this._Logo, logoObject);
}
} else {
} else if (!this.logo) {
this.patch({ Logo: undefined });
}
}
Expand All @@ -226,6 +230,11 @@ export default class Tile extends Surface {
? this._progressBarY - this.style.paddingYBetweenContent
: this._h - this.style.paddingY;
}

get _shouldShowLogo() {
return this.logo && (this.persistentMetadata || this._isFocusedMode);
}

/* ------------------------------ Artwork ------------------------------ */

_updateArtwork() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ describe('Tile', () => {
progress: 0.5
};
await tile.__updateSpyPromise;
expect(tile._gradient).toBe(false);
expect(tile._gradient).toBe(true);
tile.progressBar = {
progress: 0
};
Expand Down

0 comments on commit eaf21c9

Please sign in to comment.