@salesforcedevs/docs-components
Advanced tools
Comparing version 1.3.300-scroll-alpha2 to 1.3.300-scroll-alpha3
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "1.3.300-scroll-alpha2", | ||
"version": "1.3.300-scroll-alpha3", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -240,2 +240,10 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
const docHeaderHeight = docHeaderEl.getBoundingClientRect().height; | ||
const totalHeaderHeight = globalNavHeight + docHeaderHeight + 40; | ||
// Selecting the doc section heading and RNB here. | ||
const docHeadingEls = Array.from( | ||
document.querySelectorAll("doc-heading") | ||
); | ||
const rightNavBarEl = this.template.querySelector(".right-nav-bar"); | ||
sidebarEl.style.setProperty( | ||
@@ -251,2 +259,22 @@ "--dx-c-content-sidebar-sticky-top", | ||
// Adjusting the doc section heading on scroll. | ||
docHeadingEls.forEach((docHeadingEl) => { | ||
(docHeadingEl as any).style.scrollMarginTop = docPhaseEl | ||
? `${ | ||
totalHeaderHeight + | ||
docPhaseEl.getBoundingClientRect().height | ||
}px` | ||
: `${totalHeaderHeight}px`; | ||
}); | ||
// Adjusting the right nav bar on scroll. | ||
if (rightNavBarEl) { | ||
rightNavBarEl.style.top = docPhaseEl | ||
? `${ | ||
totalHeaderHeight + | ||
docPhaseEl.getBoundingClientRect().height | ||
}px` | ||
: `${totalHeaderHeight}px`; | ||
} | ||
// If doc phase element exists, we need to account for its sticky position. Mobile should include the sidebar height (since it becomes sticky aswell). | ||
@@ -264,27 +292,2 @@ if (docPhaseEl) { | ||
); | ||
// Adjust scroll margin for doc headings when doc phase is present | ||
const docHeadingEls = Array.from( | ||
document.querySelectorAll("doc-heading") | ||
); | ||
docHeadingEls.forEach((docHeadingEl) => { | ||
(docHeadingEl as any).style.scrollMarginTop = `${ | ||
globalNavHeight + | ||
docHeaderHeight + | ||
docPhaseEl.getBoundingClientRect().height + | ||
40 | ||
}px`; | ||
}); | ||
// Adjust right nav bar position when doc phase is present | ||
const rightNavBarEl = | ||
this.template.querySelector(".right-nav-bar"); | ||
if (rightNavBarEl) { | ||
rightNavBarEl.style.top = `${ | ||
globalNavHeight + | ||
docHeaderHeight + | ||
docPhaseEl.getBoundingClientRect().height | ||
}px`; | ||
} | ||
} | ||
@@ -291,0 +294,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
254819
6536