From b43df8f35bf1ec2fd8662ca3cc87d9568cc3dc40 Mon Sep 17 00:00:00 2001 From: Firman Ramdhani <33869609+firmanramdhani@users.noreply.github.com> Date: Wed, 29 Jul 2026 15:42:39 +0700 Subject: [PATCH] refactor: transition navigation to a persistent fixed-wrapper layout with improved scroll-based floating state styles --- apps/product-site/src/app/[locale]/page.tsx | 12 ++- apps/product-site/src/app/globals.css | 86 +++++---------------- 2 files changed, 28 insertions(+), 70 deletions(-) diff --git a/apps/product-site/src/app/[locale]/page.tsx b/apps/product-site/src/app/[locale]/page.tsx index 6ec526c..7b9ab47 100644 --- a/apps/product-site/src/app/[locale]/page.tsx +++ b/apps/product-site/src/app/[locale]/page.tsx @@ -61,10 +61,10 @@ export default function Page() { return (
- {/* ============ NAV + HERO ============ */} -
+ {/* ============ FIXED NAV ============ */} +
-
+
+ +
+

diff --git a/apps/product-site/src/app/globals.css b/apps/product-site/src/app/globals.css index 38d67ea..d4f1b36 100644 --- a/apps/product-site/src/app/globals.css +++ b/apps/product-site/src/app/globals.css @@ -152,32 +152,7 @@ /* Animations that are hard to replicate purely via utility classes */ @layer utilities { - .nav-floating { - position: fixed; - top: 16px; - left: 50%; - transform: translateX(-50%); - width: calc(100% - 40px); - max-width: 1120px; - background: var(--color-brand-1-900); - backdrop-filter: blur(14px); - -webkit-backdrop-filter: blur(14px); - border: 1px solid rgba(255, 255, 255, 0.1); - box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.55); - z-index: 1000; - animation: navFloatIn 0.4s cubic-bezier(0.16, 0.8, 0.44, 1); - } - @keyframes navFloatIn { - from { - opacity: 0; - transform: translate(-50%, -16px); - } - to { - opacity: 1; - transform: translate(-50%, 0); - } - } .drift-a { animation: driftA 7s ease-in-out infinite; @@ -392,59 +367,38 @@ } /* ---------- Nav ---------- */ +.nav-wrapper { + position: fixed; + top: 0; + left: 0; + width: 100%; + z-index: 1000; + pointer-events: none; /* Let clicks pass through empty space */ +} + +.nav-wrapper .container { + pointer-events: auto; /* Enable clicks on the nav itself */ +} + .nav { - position: relative; - z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 26px 0; - transition: - background 0.35s ease, - box-shadow 0.35s ease, - padding 0.35s ease, - border-color 0.35s ease; + border-radius: var(--radius-md); + margin-top: 0; + border: 1px solid transparent; + transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); } -.nav.nav-floating { - position: fixed; - top: 16px; - left: 50%; - transform: translateX(-50%); - width: calc(100% - 40px); - max-width: 1120px; +.nav-wrapper.floating .nav { + margin-top: 16px; background: var(--color-brand-1-900); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255, 255, 255, 0.1); - border-radius: var(--radius-md); padding: 12px 26px; box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.55); - z-index: 1000; - animation: navFloatIn 0.4s cubic-bezier(0.16, 0.8, 0.44, 1); -} - -@keyframes navFloatIn { - from { - opacity: 0; - transform: translate(-50%, -16px); - } - - to { - opacity: 1; - transform: translate(-50%, 0); - } -} - -.nav-spacer { - display: none; - height: 0; -} - -.nav-floating ~ .nav-spacer, -body.nav-is-floating .nav-spacer { - display: block; - height: 74px; } .brand { @@ -525,7 +479,7 @@ body.nav-is-floating .nav-spacer { .hero-inner { position: relative; z-index: 2; - padding: 8px 0 64px; + padding: 94px 0 64px; } .hero h1 {