mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 02:40:22 -10:00
Bug 1851839 - keep shopping sidebar header position fixed and fix close button alignment r=desktop-theme-reviewers,shopping-reviewers,niklas
Differential Revision: https://phabricator.services.mozilla.com/D188528
This commit is contained in:
1 parent
75d6eae36c
commit
1372853add
3 files changed
+31
-3
No files matched your search
@@ -23,8 +23,14 @@
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background-color: var(--shopping-header-background);
|
||||
box-sizing: border-box;
|
||||
padding-block: 16px 8px;
|
||||
padding-inline: 16px 8px;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
#shopping-header {
|
||||
@@ -38,6 +44,10 @@
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.shopping-header-overflow {
|
||||
box-shadow: 0 1px 2px 0 rgba(58, 57, 68, 0.20);
|
||||
}
|
||||
|
||||
#beta-marker {
|
||||
font-weight: 400;
|
||||
padding: 0.09375rem 0.25rem;
|
||||
@@ -57,11 +67,11 @@
|
||||
background-image: url("chrome://global/skin/icons/close.svg");
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
|
||||
#content {
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
|
||||
@@ -24,6 +24,10 @@ import "chrome://browser/content/shopping/unanalyzed.mjs";
|
||||
// eslint-disable-next-line import/no-unassigned-import
|
||||
import "chrome://browser/content/shopping/recommended-ad.mjs";
|
||||
|
||||
// The number of pixels that must be scrolled from the
|
||||
// top of the sidebar to show the header box shadow.
|
||||
const HEADER_SCROLL_PIXEL_OFFSET = 8;
|
||||
|
||||
export class ShoppingContainer extends MozLitElement {
|
||||
static properties = {
|
||||
data: { type: Object },
|
||||
@@ -36,6 +40,7 @@ export class ShoppingContainer extends MozLitElement {
|
||||
adsEnabled: { type: Boolean },
|
||||
adsEnabledByUser: { type: Boolean },
|
||||
isAnalysisInProgress: { type: Boolean },
|
||||
isOverflow: { type: Boolean },
|
||||
};
|
||||
|
||||
static get queries() {
|
||||
@@ -64,6 +69,7 @@ export class ShoppingContainer extends MozLitElement {
|
||||
window.document.addEventListener("ReanalysisRequested", this);
|
||||
window.document.addEventListener("ReportedProductAvailable", this);
|
||||
window.document.addEventListener("adsEnabledByUserChanged", this);
|
||||
window.document.addEventListener("scroll", this);
|
||||
|
||||
window.dispatchEvent(
|
||||
new CustomEvent("ContentReady", {
|
||||
@@ -133,6 +139,10 @@ export class ShoppingContainer extends MozLitElement {
|
||||
case "adsEnabledByUserChanged":
|
||||
this.adsEnabledByUser = event.detail?.adsEnabledByUser;
|
||||
break;
|
||||
case "scroll":
|
||||
let scrollYPosition = window.scrollY;
|
||||
this.isOverflow = scrollYPosition > HEADER_SCROLL_PIXEL_OFFSET;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,8 +275,15 @@ export class ShoppingContainer extends MozLitElement {
|
||||
rel="stylesheet"
|
||||
href="chrome://global/skin/in-content/common.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="chrome://browser/content/shopping/shopping-page.css"
|
||||
/>
|
||||
<div id="shopping-container">
|
||||
<div id="header-wrapper">
|
||||
<div
|
||||
id="header-wrapper"
|
||||
class=${this.isOverflow ? "shopping-header-overflow" : ""}
|
||||
>
|
||||
<header id="shopping-header" data-l10n-id="shopping-a11y-header">
|
||||
<h1
|
||||
id="shopping-header-title"
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
|
||||
:root {
|
||||
--in-content-page-background: light-dark(#f9f9fb, #2b2a33);
|
||||
--shopping-header-background: var(--in-content-page-background);
|
||||
font: menu;
|
||||
}
|
||||
Reference in new issue
Block a user