fix(mobile+navbar): remove white cloudy bottom haze, immediate solid navbar transition on scroll, and restore horizontal category scroller on mobile
This commit is contained in:
@@ -285,8 +285,6 @@ export function HeroSection({
|
||||
</picture>
|
||||
{/* Dark Gradient Overlay for Maximum Text Readability */}
|
||||
<div className="absolute inset-0 bg-gradient-to-r from-black/95 via-black/75 to-black/30 sm:via-black/55 sm:to-transparent pointer-events-none" />
|
||||
{/* Smooth Bottom Blend to Section Below */}
|
||||
<div className="absolute inset-x-0 bottom-0 h-28 bg-gradient-to-t from-[#FAF8F5] via-[#FAF8F5]/70 to-transparent pointer-events-none" />
|
||||
</div>
|
||||
|
||||
{/* Zero-Overhead Scroll Sentinel for Navbar Transformation */}
|
||||
|
||||
@@ -159,7 +159,7 @@ function ShiftableRow({ items }: { items: ToolMediaItem[] }) {
|
||||
const [hoveredId, setHoveredId] = useState<string | null>(null);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col md:flex-row gap-4 sm:gap-6 w-full items-start">
|
||||
<div className="flex flex-row md:flex-row gap-4 sm:gap-6 w-full items-start overflow-x-auto md:overflow-visible pb-2 no-scrollbar scroll-smooth snap-x snap-mandatory touch-pan-x -mx-4 px-4 md:mx-0 md:px-0">
|
||||
{items.map((item) => {
|
||||
const isHovered = hoveredId === item.id;
|
||||
const hasOtherHovered = hoveredId !== null && !isHovered;
|
||||
@@ -182,7 +182,7 @@ function ShiftableRow({ items }: { items: ToolMediaItem[] }) {
|
||||
flexShrink: 1,
|
||||
flexBasis: '0%',
|
||||
}}
|
||||
className="w-full transition-[flex-grow] duration-1000 ease-[cubic-bezier(0.16,1,0.3,1)] will-change-[flex-grow] flex flex-col min-w-0"
|
||||
className="w-[82vw] sm:w-[320px] md:w-full shrink-0 md:shrink snap-start transition-[flex-grow] duration-1000 ease-[cubic-bezier(0.16,1,0.3,1)] will-change-[flex-grow] flex flex-col min-w-0"
|
||||
>
|
||||
{/* Window Container with strictly locked pixel height & landscape aspect */}
|
||||
{item.mediaType === 'comparison' ? (
|
||||
|
||||
@@ -478,12 +478,23 @@ export function ToolGridSection({
|
||||
</div>
|
||||
|
||||
{searchResults.length > 0 ? (
|
||||
/* High-Density 2-Col Grid on Phones, Responsive 3-Col Grid on Web */
|
||||
<div className="grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-3 sm:gap-7">
|
||||
{searchResults.map((tool) => (
|
||||
<ToolCard key={tool.id} tool={tool} locale={locale} />
|
||||
))}
|
||||
</div>
|
||||
<>
|
||||
{/* Search Results Mobile Horizontal Scroller */}
|
||||
<div className="flex sm:hidden overflow-x-auto gap-3.5 pb-3 -mx-4 px-4 no-scrollbar scroll-smooth snap-x snap-mandatory touch-pan-x">
|
||||
{searchResults.map((tool) => (
|
||||
<div key={tool.id} className="w-[74vw] max-w-[280px] shrink-0 snap-start">
|
||||
<ToolCard tool={tool} locale={locale} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Search Results Web Responsive Grid */}
|
||||
<div className="hidden sm:grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-6 sm:gap-7">
|
||||
{searchResults.map((tool) => (
|
||||
<ToolCard key={tool.id} tool={tool} locale={locale} />
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="text-center py-16 text-slate-500 space-y-3 font-mono">
|
||||
<p className="font-bold text-slate-800 text-base">
|
||||
@@ -569,10 +580,18 @@ export function ToolGridSection({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Responsive Visual Grid:
|
||||
- 2-Column High-Density Visual Gallery on Phones (< sm)
|
||||
- 3-Column Responsive Grid on Web/Desktop (>= sm) that continuously fills as tools are added */}
|
||||
<div className="grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-3 sm:gap-7">
|
||||
{/* Category Tools Layout:
|
||||
- Phones (< sm): Smooth horizontal scroller with prominent cards & snapping
|
||||
- Web / Desktop (>= sm): Grid that keeps filling inside naturally */}
|
||||
<div className="flex sm:hidden overflow-x-auto gap-3.5 pb-3 -mx-4 px-4 no-scrollbar scroll-smooth snap-x snap-mandatory touch-pan-x">
|
||||
{group.tools.map((tool) => (
|
||||
<div key={tool.id} className="w-[74vw] max-w-[280px] shrink-0 snap-start">
|
||||
<ToolCard tool={tool} locale={locale} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="hidden sm:grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-6 sm:gap-7">
|
||||
{group.tools.map((tool) => (
|
||||
<ToolCard key={tool.id} tool={tool} locale={locale} />
|
||||
))}
|
||||
|
||||
@@ -17,36 +17,22 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
|
||||
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
||||
const pathname = usePathname();
|
||||
|
||||
// 100% Off-Main-Thread Observer: 0% CPU, 0 Scroll Lag
|
||||
// Fast, scroll-aware navbar transformation:
|
||||
// - Homepage at rest (scrollY <= 25): Transparent text buttons over dark hero
|
||||
// - As soon as scrolled (scrollY > 25) or on any other page: Transforms into solid navbar
|
||||
useEffect(() => {
|
||||
// On non-homepage pages, navbar is immediately in solid state
|
||||
if (pathname !== '/') {
|
||||
setIsScrolled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
setIsScrolled(false);
|
||||
const sentinel = document.getElementById('hero-sentinel');
|
||||
if (!sentinel) {
|
||||
const handleScroll = () => {
|
||||
setIsScrolled(window.scrollY > 400);
|
||||
};
|
||||
window.addEventListener('scroll', handleScroll, { passive: true });
|
||||
return () => window.removeEventListener('scroll', handleScroll);
|
||||
}
|
||||
const checkScroll = () => {
|
||||
setIsScrolled(window.scrollY > 25);
|
||||
};
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
([entry]) => {
|
||||
setIsScrolled(!entry.isIntersecting && entry.boundingClientRect.top < 0);
|
||||
},
|
||||
{
|
||||
threshold: 0,
|
||||
rootMargin: '-60px 0px 0px 0px',
|
||||
}
|
||||
);
|
||||
|
||||
observer.observe(sentinel);
|
||||
return () => observer.disconnect();
|
||||
checkScroll();
|
||||
window.addEventListener('scroll', checkScroll, { passive: true });
|
||||
return () => window.removeEventListener('scroll', checkScroll);
|
||||
}, [pathname]);
|
||||
|
||||
// Close mobile menu on Escape key
|
||||
|
||||
Reference in New Issue
Block a user