- Replace icon-based category tiles with curated photo cards (brown bottom overlay, single-row layout, taller aspect ratio, tighter gaps, no card frame, light brown section background) via new CategoryShowcase component and categoryIcons fallback images. - Add ScrollReveal component for page-enter animations, used across the category showcase and other sections. - Turn the homepage "New Products" grid into a horizontal snap-scroll carousel with prev/next controls (ProductsCarousel). - Extend Pagination and the products page to preserve categoryId filters, and widen aspectRatioToCss to accept undefined. - Document the static-image-slots system and API client conventions in CLAUDE.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
48 lines
1022 B
TypeScript
48 lines
1022 B
TypeScript
"use client";
|
|
|
|
import { useEffect, useRef, useState } from "react";
|
|
import type { ReactNode } from "react";
|
|
|
|
export default function ScrollReveal({
|
|
children,
|
|
delay = 0,
|
|
className = "",
|
|
}: {
|
|
children: ReactNode;
|
|
delay?: number;
|
|
className?: string;
|
|
}) {
|
|
const ref = useRef<HTMLDivElement>(null);
|
|
const [visible, setVisible] = useState(false);
|
|
|
|
useEffect(() => {
|
|
const el = ref.current;
|
|
if (!el) return;
|
|
|
|
const observer = new IntersectionObserver(
|
|
([entry]) => {
|
|
if (entry.isIntersecting) {
|
|
setVisible(true);
|
|
observer.unobserve(el);
|
|
}
|
|
},
|
|
{ threshold: 0.15 }
|
|
);
|
|
|
|
observer.observe(el);
|
|
return () => observer.disconnect();
|
|
}, []);
|
|
|
|
return (
|
|
<div
|
|
ref={ref}
|
|
style={{ transitionDelay: visible ? `${delay}ms` : "0ms" }}
|
|
className={`transition-all duration-700 ease-out ${
|
|
visible ? "opacity-100 translate-y-0" : "opacity-0 translate-y-8"
|
|
} ${className}`}
|
|
>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|