From 9aea635e6408961238fbcdf13e80692e687c9753 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 12 Jul 2026 03:13:49 -0400 Subject: [PATCH] x --- apps/spa/src/components/ProductImageGallery.tsx | 12 ++++++------ apps/website/src/components/ProductGallery.tsx | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/spa/src/components/ProductImageGallery.tsx b/apps/spa/src/components/ProductImageGallery.tsx index 403d9f1..bd322f5 100644 --- a/apps/spa/src/components/ProductImageGallery.tsx +++ b/apps/spa/src/components/ProductImageGallery.tsx @@ -12,15 +12,15 @@ export default function ProductImageGallery({ images, fallback, alt = 'Product I const [currentIndex, setCurrentIndex] = useState(0) const scrollRef = useRef(null) - useEffect(() => { + const handleThumbnailClick = (idx: number) => { + setCurrentIndex(idx) if (scrollRef.current) { - const container = scrollRef.current - const child = container.children[currentIndex] as HTMLElement + const child = scrollRef.current.children[idx] as HTMLElement if (child) { - container.scrollTo({ left: child.offsetLeft, behavior: 'smooth' }) + scrollRef.current.scrollTo({ left: child.offsetLeft, behavior: 'smooth' }) } } - }, [currentIndex]) + } const handleScroll = (e: React.UIEvent) => { const container = e.currentTarget @@ -66,7 +66,7 @@ export default function ProductImageGallery({ images, fallback, alt = 'Product I