feat: implement multi-tier progressive gradient blur canopy on navbar

This commit is contained in:
2026-11-04 12:55:21 +05:30
parent b903cd0ecd
commit a53d8fc2aa
+67 -14
View File
@@ -35,17 +35,72 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
}, [mobileMenuOpen]); }, [mobileMenuOpen]);
return ( return (
<header <header className="fixed top-0 left-0 right-0 w-full z-50 pointer-events-none transition-all duration-300">
className={`fixed top-0 left-0 right-0 w-full z-50 transition-all duration-300 ${ {/* 1. Progressive Multi-Tier Gradient Blur Canopy (Extends 120px down from the top) */}
isScrolled <div className="absolute top-0 inset-x-0 h-[120px] sm:h-[135px] pointer-events-none overflow-hidden select-none">
? 'bg-[#FAF8F5] border-b border-slate-900/[0.08] shadow-[0_4px_20px_-4px_rgba(15,23,42,0.06)] py-3' {/* Tier 1: Deep subtle blur (softest edge at the bottom) */}
: 'bg-[#FAF8F5]/95 backdrop-blur-md border-b border-slate-900/[0.04] py-3.5 sm:py-4' <div
}`} className="absolute inset-0 backdrop-blur-[2px]"
> style={{
{/* Top Prismatic Micro-Highlight */} maskImage: 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 100%)',
<div className="absolute top-0 inset-x-0 h-[1px] bg-gradient-to-r from-transparent via-white/80 to-transparent pointer-events-none" /> WebkitMaskImage: 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 100%)',
}}
/>
{/* Main Aligned Edge-to-Edge Container */} {/* Tier 2: Low-mid progressive blur */}
<div
className="absolute inset-0 backdrop-blur-[6px]"
style={{
maskImage: 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,0) 80%)',
WebkitMaskImage: 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,0) 80%)',
}}
/>
{/* Tier 3: Medium progressive blur */}
<div
className="absolute inset-0 backdrop-blur-[12px]"
style={{
maskImage: 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 22%, rgba(0,0,0,0) 65%)',
WebkitMaskImage: 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 22%, rgba(0,0,0,0) 65%)',
}}
/>
{/* Tier 4: Strong progressive blur */}
<div
className="absolute inset-0 backdrop-blur-[24px]"
style={{
maskImage: 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 15%, rgba(0,0,0,0) 50%)',
WebkitMaskImage: 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 15%, rgba(0,0,0,0) 50%)',
}}
/>
{/* Tier 5: Ultra dense frosted blur under the main header */}
<div
className="absolute inset-0 backdrop-blur-[40px]"
style={{
maskImage: 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 10%, rgba(0,0,0,0) 40%)',
WebkitMaskImage: 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 10%, rgba(0,0,0,0) 40%)',
}}
/>
{/* Progressive Color Tint: Melts scrolling content softly into the warm page canvas background (#FAF8F5) */}
<div
className="absolute inset-0 bg-gradient-to-b from-[#FAF8F5] via-[#FAF8F5]/92 to-transparent pointer-events-none"
style={{
maskImage: 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 45%, rgba(0,0,0,0) 95%)',
WebkitMaskImage: 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 45%, rgba(0,0,0,0) 95%)',
}}
/>
{/* Soft feather at bottom */}
<div className="absolute bottom-0 inset-x-0 h-6 bg-gradient-to-b from-transparent to-[#FAF8F5]/0 pointer-events-none" />
</div>
{/* 2. Top Prismatic Micro-Highlight */}
<div className="absolute top-0 inset-x-0 h-[1px] bg-gradient-to-r from-transparent via-white/80 to-transparent pointer-events-none z-30" />
{/* 3. Main Aligned Edge-to-Edge Navigation Bar */}
<div className={`relative z-30 pointer-events-auto transition-all duration-300 ${isScrolled ? 'py-3' : 'py-3.5 sm:py-4'}`}>
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 flex items-center justify-between"> <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 flex items-center justify-between">
{/* Brand Logo */} {/* Brand Logo */}
<div className="relative z-20 flex-shrink-0"> <div className="relative z-20 flex-shrink-0">
@@ -107,13 +162,14 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
</button> </button>
</div> </div>
</div> </div>
</div>
{/* Mobile Drawer (Full width dropdown) */} {/* Mobile Drawer (Full width dropdown) */}
{mobileMenuOpen && ( {mobileMenuOpen && (
<nav <nav
id="mobile-navigation" id="mobile-navigation"
aria-label="Mobile navigation" aria-label="Mobile navigation"
className="md:hidden mt-3 border-t border-slate-900/[0.08] bg-[#FAF8F5]/98 backdrop-blur-2xl p-5 space-y-3 shadow-2xl animate-in slide-in-from-top-2 duration-200" className="md:hidden mt-1 pointer-events-auto border-t border-slate-900/[0.08] bg-[#FAF8F5]/98 backdrop-blur-2xl p-5 space-y-3 shadow-2xl animate-in slide-in-from-top-2 duration-200"
> >
<div className="max-w-7xl mx-auto space-y-1"> <div className="max-w-7xl mx-auto space-y-1">
{config.nav.header.map((item) => { {config.nav.header.map((item) => {
@@ -159,9 +215,6 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
</div> </div>
</nav> </nav>
)} )}
{/* Optical Dissolve Edge (soft feather at bottom edge so content seamlessly melts inside it) */}
<div className="absolute -bottom-3 inset-x-0 h-3 bg-gradient-to-b from-[#FAF8F5] to-transparent pointer-events-none opacity-80" />
</header> </header>
); );
} }