diff --git a/client/src/components/netflix-grid.tsx b/client/src/components/netflix-grid.tsx index b8361ae..021a8b7 100644 --- a/client/src/components/netflix-grid.tsx +++ b/client/src/components/netflix-grid.tsx @@ -270,10 +270,9 @@ function CategoryRow({ category, onVideoClick, hideScrollButtons = false }: Cate const isMobile = window.innerWidth < 768; if (isMobile) { - // On mobile, cards snap to left edge + // On mobile, one full card at a time const cardWidth = containerWidth - 24; // Account for container margins (12px each side) - const gap = 12; - const newIndex = Math.round(scrollLeft / (cardWidth + gap)); + const newIndex = Math.round(scrollLeft / cardWidth); setCurrentIndex(Math.min(newIndex, 9)); // Max 9 for 10 cards (0-indexed) } } @@ -302,10 +301,9 @@ function CategoryRow({ category, onVideoClick, hideScrollButtons = false }: Cate if (scrollRef.current) { const containerWidth = scrollRef.current.clientWidth; const cardWidth = containerWidth - 24; // Account for container margins - const gap = 12; - // Scroll so next card aligns to left edge (accounting for container padding) + // Scroll so only one full card is visible scrollRef.current.scrollTo({ - left: nextIndex * (cardWidth + gap) + 12, // +12 for left container padding + left: nextIndex * cardWidth, behavior: 'smooth' }); setCurrentIndex(nextIndex); @@ -318,10 +316,9 @@ function CategoryRow({ category, onVideoClick, hideScrollButtons = false }: Cate if (scrollRef.current) { const containerWidth = scrollRef.current.clientWidth; const cardWidth = containerWidth - 24; // Account for container margins - const gap = 12; - // Scroll so previous card aligns to left edge (accounting for container padding) + // Scroll so only one full card is visible scrollRef.current.scrollTo({ - left: prevIndex * (cardWidth + gap) + 12, // +12 for left container padding + left: prevIndex * cardWidth, behavior: 'smooth' }); setCurrentIndex(prevIndex); @@ -367,8 +364,8 @@ function CategoryRow({ category, onVideoClick, hideScrollButtons = false }: Cate {/* Scrollable video row - in container */}
(
setClickedVideoId(video.id)} > {/* Top 10 Number overlay for first category */} @@ -397,6 +394,7 @@ function CategoryRow({ category, onVideoClick, hideScrollButtons = false }: Cate onVideoClick(video); }} className="w-full hover:scale-102 md:hover:scale-105 hover:z-50 transition-all duration-300 md:duration-500 hover:shadow-2xl rounded-lg overflow-hidden" + style={{ scrollSnapAlign: 'start' }} />
))} @@ -411,9 +409,8 @@ function CategoryRow({ category, onVideoClick, hideScrollButtons = false }: Cate if (scrollRef.current) { const containerWidth = scrollRef.current.clientWidth; const cardWidth = containerWidth - 24; // Account for margins - const gap = 12; scrollRef.current.scrollTo({ - left: index * (cardWidth + gap), + left: index * cardWidth, behavior: 'smooth' }); setCurrentIndex(index);