Skip to content

Commit 2f6ed48

Browse files
authored
Fix/make css related changes in landing page (#173)
* fix: solve overlap issue in community support card * fix: resolve card view issue of popular integration section * fix: change css for hero section banner * fix: hero banner button css * fix: resolve button size issue * fix: remove unused padding * fix: change css for search bar * fix: add proper padding * fix: solve sidebar highlight issue * fix: resolve overlap issue in bottom of toc * fix: change css for sidebar and toc * fix: resolve auto scroll issue * fix: add top padding * fix: resolve highlight issue * fix: resolve toc issue * fix: remove unused z-index * fix: solve sidebar and toc sidebar issue * fix: remove unused css * fix: logo position issue * fix: resolve path issue of mobile screen logo * fix: resolve sidebar scroll issue * fix: remove background from title of secondary sidebar * fix: make css related changes * fix: change theme moon icon color * fix: add required css * fix: make md-content left side with actual font size * fix: full-width md-content with actual font size * fix: left side md-content with character limit with actual font size * fix: resolve main page width issue * fix: make md-content center in screen with actual font-size * feat: make search bar for for searching * fix: md content left-container * fix: make css related changes * fix: md-content in center with container view * fix: md-content left with container view * fix: make container view width
1 parent 9339221 commit 2f6ed48

File tree

16 files changed

+3918
-2782
lines changed

16 files changed

+3918
-2782
lines changed

docs/assets/close-icon.svg

Lines changed: 14 additions & 0 deletions
Loading

docs/assets/moon.svg

Lines changed: 5 additions & 5 deletions
Loading

docs/js/search-close-minimal.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,65 @@
1+
// Show/hide close icon based on .md-search-result__meta visibility
2+
function isElementInViewport(el) {
3+
if (!el) return false;
4+
const rect = el.getBoundingClientRect();
5+
return (
6+
rect.top < window.innerHeight &&
7+
rect.bottom > 0 &&
8+
rect.left < window.innerWidth &&
9+
rect.right > 0
10+
);
11+
}
12+
13+
function toggleCloseIconVisibility() {
14+
const meta = document.querySelector(".md-search-result__meta");
15+
const closeIcon = document.querySelector(".md-search__close");
16+
if (closeIcon) {
17+
if (isElementInViewport(meta)) {
18+
closeIcon.style.display = "flex";
19+
} else {
20+
closeIcon.style.display = "none";
21+
}
22+
}
23+
}
24+
25+
window.addEventListener("scroll", toggleCloseIconVisibility);
26+
window.addEventListener("resize", toggleCloseIconVisibility);
27+
document.addEventListener("DOMContentLoaded", toggleCloseIconVisibility);
28+
// Also run after search results update
29+
document.addEventListener("input", function (e) {
30+
if (e.target.classList.contains("md-search__input")) {
31+
setTimeout(toggleCloseIconVisibility, 50);
32+
}
33+
});
134
/**
235
* Minimal Search Close Functionality
336
* Adds click handler to the close icon in the search input
437
*/
538

639
document.addEventListener("DOMContentLoaded", function () {
40+
// Inject clear button if not present
41+
const searchInput = document.querySelector(".md-search__input");
42+
if (searchInput && !document.querySelector(".md-search__clear")) {
43+
const clearBtn = document.createElement("button");
44+
clearBtn.className = "md-search__clear";
45+
clearBtn.type = "button";
46+
clearBtn.textContent = "Clear";
47+
searchInput.parentNode.insertBefore(clearBtn, searchInput.nextSibling);
48+
49+
clearBtn.addEventListener("click", function () {
50+
searchInput.value = "";
51+
searchInput.dispatchEvent(new Event("input", { bubbles: true }));
52+
searchInput.focus();
53+
clearBtn.style.display = "none";
54+
});
55+
56+
searchInput.addEventListener("input", function () {
57+
clearBtn.style.display = searchInput.value ? "inline" : "none";
58+
});
59+
60+
// Initial state
61+
clearBtn.style.display = searchInput.value ? "inline" : "none";
62+
}
763
// Add click handler to search input when close icon area is clicked
864
document.addEventListener("click", function (e) {
965
const searchInput = document.querySelector(".md-search__input");

docs/js/toc-highlight.js

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/**
2+
* Simple TOC scroll-based highlighting
3+
* Highlights current section in purple text
4+
*/
5+
6+
(function () {
7+
"use strict";
8+
9+
let tocLinks = [];
10+
let headings = [];
11+
12+
function init() {
13+
// Find TOC links
14+
tocLinks = Array.from(
15+
document.querySelectorAll(".md-nav--secondary .md-nav__link")
16+
);
17+
if (tocLinks.length === 0) return;
18+
19+
// Find corresponding headings
20+
headings = tocLinks
21+
.map((link) => {
22+
const href = link.getAttribute("href");
23+
return href && href.startsWith("#")
24+
? document.getElementById(href.substring(1))
25+
: null;
26+
})
27+
.filter((h) => h !== null);
28+
29+
if (headings.length === 0) return;
30+
31+
// Listen to scroll
32+
window.addEventListener("scroll", updateHighlight, { passive: true });
33+
updateHighlight();
34+
}
35+
36+
function updateHighlight() {
37+
const scrollTop = window.pageYOffset;
38+
const windowHeight = window.innerHeight;
39+
const documentHeight = document.documentElement.scrollHeight;
40+
41+
// If near bottom, highlight last item
42+
if (scrollTop + windowHeight >= documentHeight - 50) {
43+
setActive(tocLinks.length - 1);
44+
return;
45+
}
46+
47+
// Find current section
48+
let activeIndex = -1;
49+
for (let i = headings.length - 1; i >= 0; i--) {
50+
if (headings[i] && headings[i].getBoundingClientRect().top <= 80) {
51+
activeIndex = i;
52+
break;
53+
}
54+
}
55+
56+
setActive(activeIndex);
57+
}
58+
59+
function setActive(index) {
60+
// Remove all active classes
61+
tocLinks.forEach((link) => {
62+
link.classList.remove("md-nav__link--active", "is-active");
63+
});
64+
65+
// Add active class to current item and scroll into view if needed
66+
if (index >= 0 && index < tocLinks.length) {
67+
const activeLink = tocLinks[index];
68+
activeLink.classList.add("md-nav__link--active", "is-active");
69+
// Scroll the active link into view within the sidebar
70+
// Only if not already fully visible
71+
if (typeof activeLink.scrollIntoView === "function") {
72+
activeLink.scrollIntoView({ block: "nearest", behavior: "smooth" });
73+
}
74+
}
75+
}
76+
77+
// Initialize when ready
78+
if (document.readyState === "loading") {
79+
document.addEventListener("DOMContentLoaded", init);
80+
} else {
81+
init();
82+
}
83+
84+
// Re-initialize on page changes
85+
let currentUrl = location.href;
86+
new MutationObserver(() => {
87+
if (location.href !== currentUrl) {
88+
currentUrl = location.href;
89+
setTimeout(init, 100);
90+
}
91+
}).observe(document, { childList: true, subtree: true });
92+
})();

0 commit comments

Comments
 (0)