feat(homepage): refine gradient rightwards, dim hero background, seamless bottom fade, and scroll-activated navbar

This commit is contained in:
2026-11-05 18:02:18 +05:30
parent e592b397cc
commit d225e7ab6e
2 changed files with 60 additions and 15 deletions
+15 -11
View File
@@ -263,12 +263,14 @@ export function HeroSection({
// -------------------------------------------------------------
// 3. Pure Front Page Hero View (for homepage /):
// Matching User Reference Image: Image_homepage.jpg background with
// White/Cream Gradient Overlay, Editorial Typography, and Telemetry Capsule
// Matching User Specifications:
// - Slightly dimmer background image (opacity-85 brightness-[0.88])
// - Extended white/cream gradient to the right (~75% width)
// - Perfect bottom fade (h-28 sm:h-36) seamlessly blending with content below
// -------------------------------------------------------------
return (
<section className="relative min-h-[92vh] sm:min-h-screen flex items-center overflow-hidden bg-[#FAF8F5] pt-20 sm:pt-24 pb-14 sm:pb-20">
{/* 1. Background Image with Responsive Ultra-Fast Loading */}
<section id="hero-section" className="relative min-h-[92vh] sm:min-h-screen flex items-center overflow-hidden bg-[#FAF8F5] pt-20 sm:pt-24 pb-14 sm:pb-20">
{/* 1. Background Image with Responsive Ultra-Fast Loading & Subtle Dimming */}
<div className="absolute inset-0 z-0 overflow-hidden">
<picture>
<source media="(max-width: 768px)" srcSet="/management/pages/home/hero_mobile.webp" type="image/webp" />
@@ -277,20 +279,22 @@ export function HeroSection({
<img
src="/management/pages/home/hero_desktop.jpg"
alt="CRE AI Photo Magic"
className="w-full h-full object-cover object-[75%_center] sm:object-right-top select-none pointer-events-none"
className="w-full h-full object-cover object-[75%_center] sm:object-right-top select-none pointer-events-none opacity-72 brightness-[0.82] contrast-[0.98]"
loading="eager"
fetchPriority="high"
decoding="async"
/>
</picture>
{/* White / Cream Gradient Overlay: Restrained to left side so background artwork & glowing ribbons stay clearly visible */}
<div className="absolute inset-0 bg-gradient-to-r from-[#FAF8F5]/90 via-[#FAF8F5]/40 via-30% to-transparent to-55% sm:via-30% sm:to-55% pointer-events-none" />
{/* Soft Bottom Fade to Seamlessly Blend with Upcoming Scroll Content */}
<div className="absolute inset-x-0 bottom-0 h-16 sm:h-20 bg-gradient-to-t from-[#FAF8F5] to-transparent pointer-events-none" />
{/* White / Cream Gradient Overlay: Extended towards the right (~88%) for smooth, balanced contrast */}
<div className="absolute inset-0 bg-gradient-to-r from-[#FAF8F5] from-30% via-[#FAF8F5]/90 via-55% via-[#FAF8F5]/50 via-75% to-transparent to-90% pointer-events-none" />
{/* Mobile vertical soft overlay to keep text completely readable on small screens */}
<div className="absolute inset-0 bg-gradient-to-b from-[#FAF8F5]/80 via-[#FAF8F5]/60 via-40% to-[#FAF8F5] sm:hidden pointer-events-none" />
{/* Perfect Bottom Fade: Seamlessly blends with upcoming scroll content (#our-tools) */}
<div className="absolute inset-x-0 bottom-0 h-44 sm:h-64 lg:h-80 bg-gradient-to-t from-[#FAF8F5] from-20% via-[#FAF8F5]/95 via-50% via-[#FAF8F5]/50 via-80% to-transparent pointer-events-none" />
</div>
{/* Zero-Overhead Scroll Sentinel */}
<div id="hero-sentinel" className="absolute bottom-28 left-0 w-full h-1 pointer-events-none opacity-0" aria-hidden="true" />
{/* Hero End Sentinel for exact scroll position detection */}
<div id="hero-end-sentinel" className="absolute bottom-0 left-0 w-full h-2 pointer-events-none opacity-0" aria-hidden="true" />
{/* 2. Left-Aligned Content Container */}
<div className="relative z-10 max-w-[1640px] w-full mx-auto px-4 sm:px-8 lg:px-14 flex flex-col justify-center min-h-[90vh] sm:min-h-[92vh]">
+45 -4
View File
@@ -14,8 +14,34 @@ interface NavbarProps {
export function Navbar({ config, currentLocale }: NavbarProps) {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const [isScrolledPastHero, setIsScrolledPastHero] = useState(false);
const pathname = usePathname();
// Scroll detection:
// - On homepage: transparent text buttons while hero image is visible.
// - Once hero image area is completely scrolled up (or on other pages): transforms into the navbar!
useEffect(() => {
if (pathname !== '/') {
setIsScrolledPastHero(true);
return;
}
const checkScroll = () => {
const hero = document.getElementById('hero-section');
// Hero image area is completely scrolled up when window.scrollY reaches hero.offsetHeight
const threshold = hero ? Math.max(300, hero.offsetHeight - 4) : window.innerHeight;
setIsScrolledPastHero(window.scrollY >= threshold);
};
checkScroll();
window.addEventListener('scroll', checkScroll, { passive: true });
window.addEventListener('resize', checkScroll, { passive: true });
return () => {
window.removeEventListener('scroll', checkScroll);
window.removeEventListener('resize', checkScroll);
};
}, [pathname]);
// Close mobile menu on Escape key
useEffect(() => {
if (!mobileMenuOpen) return;
@@ -41,11 +67,22 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
};
}, [mobileMenuOpen]);
// Text-only mode while viewing the homepage hero image
const isTextOnlyMode = pathname === '/' && !isScrolledPastHero;
return (
<header className="fixed top-0 left-0 right-0 w-full z-50 bg-[#FAF8F5]/96 backdrop-blur-sm border-b border-slate-200/90 shadow-2xs py-2.5 sm:py-3 transition-colors duration-200 pointer-events-auto">
<header
className={`fixed top-0 left-0 right-0 w-full z-50 transition-[background-color,border-color,padding,box-shadow] duration-300 pointer-events-auto ${
mobileMenuOpen
? 'bg-[#FAF8F5] border-b border-slate-200/90 shadow-2xs py-2.5 sm:py-3'
: isTextOnlyMode
? 'bg-transparent border-b border-transparent py-3 sm:py-4'
: 'bg-[#FAF8F5]/96 backdrop-blur-sm border-b border-slate-200/90 shadow-2xs py-2 sm:py-2.5'
}`}
>
<div className="max-w-[1640px] mx-auto px-4 sm:px-6 lg:px-10 flex items-center justify-between">
{/* Brand Logo */}
<div className="relative z-20 flex-shrink-0">
{/* Brand Logo - In text-only mode on hero it is hidden, sliding into place when scrolled past hero */}
<div className={`relative z-20 flex-shrink-0 transition-all duration-300 ${isTextOnlyMode ? 'opacity-0 -translate-x-3 pointer-events-none' : 'opacity-100 translate-x-0'}`}>
<BrandLogo size="md" />
</div>
@@ -121,7 +158,11 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
<div className="flex md:hidden items-center space-x-2 relative z-20">
<button
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
className="p-2.5 rounded-xl border text-slate-800 bg-white hover:bg-slate-50 border-slate-200/90 shadow-2xs transition-colors active:scale-95"
className={`transition-all duration-300 active:scale-95 ${
isTextOnlyMode && !mobileMenuOpen
? 'p-2 text-slate-800 hover:text-blue-600 bg-transparent border-transparent'
: 'p-2.5 rounded-xl border text-slate-800 bg-white hover:bg-slate-50 border-slate-200/90 shadow-2xs'
}`}
aria-label={mobileMenuOpen ? 'Close navigation menu' : 'Open navigation menu'}
aria-expanded={mobileMenuOpen}
>