Skip to content

Commit

Permalink
Merge branch 'feature/fix-docs-css' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLoy committed Jan 12, 2025
2 parents 16a6410 + 234a1a9 commit 9018172
Show file tree
Hide file tree
Showing 8 changed files with 658 additions and 382 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "vscode.html-language-features"
},
"editor.tabSize": 2,
"editor.insertSpaces": true,
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/assets/main.min..css

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/dist/assets/main.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dist/assets/main.min.js.map

Large diffs are not rendered by default.

466 changes: 284 additions & 182 deletions docs/dist/index.html

Large diffs are not rendered by default.

65 changes: 55 additions & 10 deletions docs/src/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,18 @@ const nav = document.querySelector(".nav-wrapper");
nav.classList.add("transition-colors", "duration-300");

function updateNavBackground() {
const scrollPosition = window.scrollY;

if (scrollPosition === 0) {
// When page is at the very top
nav.classList.remove("bg-indigo-950/50", "backdrop-blur-sm");
nav.classList.add("bg-transparent");
} else {
// After scrolling even slightly
nav.classList.remove("bg-transparent");
nav.classList.add("bg-indigo-950/50", "backdrop-blur-sm");
if (window.matchMedia("(min-width: 768px)").matches) {
const scrollPosition = window.scrollY;

if (scrollPosition === 0) {
// When page is at the very top
nav.classList.remove("bg-indigo-950/50", "backdrop-blur-sm");
nav.classList.add("bg-transparent");
} else {
// After scrolling even slightly
nav.classList.remove("bg-transparent");
nav.classList.add("bg-indigo-950/50", "backdrop-blur-sm");
}
}
}

Expand Down Expand Up @@ -338,3 +340,46 @@ scrollTopBtn.addEventListener("click", () => {
});

window.addEventListener("scroll", handleScroll);

document.addEventListener("DOMContentLoaded", () => {
if (window.matchMedia("(max-width: 767px)").matches) {
const button = document.getElementById("mobile-menu-button");
const navWrapper = document.querySelector(".nav-wrapper");
const menu = document.getElementById("nav-menu");
let isOpen = false;

const toggleMenu = () => {
isOpen = !isOpen;
// Use transform for performance and opacity for fade effect
menu.classList.toggle("nav-list-open");
button.setAttribute("aria-expanded", isOpen);

// Toggle navigation background styles
navWrapper.classList.toggle("--active");
navWrapper.classList.toggle("bg-indigo-950");
navWrapper.classList.toggle("backdrop-blur-sm");
navWrapper.classList.toggle("bg-indigo-950/50");
};

button.addEventListener("click", toggleMenu);

document.addEventListener("keydown", (e) => {
if (e.key === "Escape" && isOpen) {
toggleMenu();
}
});

document.addEventListener("click", (e) => {
if (isOpen && !menu.contains(e.target) && !button.contains(e.target)) {
toggleMenu();
}
});

const mobileNavLinks = menu.querySelectorAll('a[href^="#"]');
mobileNavLinks.forEach((link) => {
link.addEventListener("click", () => {
toggleMenu();
});
});
}
});
27 changes: 27 additions & 0 deletions docs/src/assets/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,33 @@
.sc-doc-block {
@apply bg-gray-800 p-6 rounded-xl shadow-sm;
}

.section-title {
@apply text-2xl sm:text-3xl lg:text-4xl font-bold mb-6 sm:mb-8 flex items-center gap-2 sm:gap-3;
}

.section-title__icon {
@apply hidden sm:inline-block w-4 h-4 sm:w-6 sm:h-6 lg:w-7 lg:h-7 text-indigo-600;
}

.nav-list {
@apply absolute flex-col translate-y-[-100%] opacity-0 pointer-events-none
inset-x-0 top-[60px] bg-indigo-950/90 backdrop-blur-md p-4
space-y-4 gap-4 transition-all duration-300 ease-in-out;
}

.nav-list-open {
@apply translate-y-0 opacity-100 pointer-events-auto;
}

/* Desktop overrides */
@screen md {
.nav-list {
@apply flex relative flex-row translate-y-0 opacity-100 pointer-events-auto
inset-x-auto top-0 bg-transparent backdrop-blur-none p-0
space-y-0 items-center gap-6;
}
}
}

.package-manager-btn {
Expand Down
466 changes: 284 additions & 182 deletions docs/src/index.html

Large diffs are not rendered by default.

0 comments on commit 9018172

Please sign in to comment.