Improve video carousel scrolling and spacing for better user experience

Refactor CategoryRow component in netflix-grid.tsx to adjust scrolling step, remove redundant logic for auto-scroll and speed toggle, and update spacing and overflow properties for the video grid.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 2eb1084e-b728-4449-9231-f1665924c8d5
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2eb1084e-b728-4449-9231-f1665924c8d5/yexZbDm
This commit is contained in:
sebastjanartic 2025-08-29 16:50:30 +00:00
parent de28ffe5ea
commit 3baeabcbc7

View File

@ -144,8 +144,8 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
const videoWidth = 120; // Width including spacing
const scroll = (direction: 'left' | 'right') => {
// Only move one step when clicked (no speed change here)
const step = direction === 'right' ? -videoWidth : videoWidth;
// Simple step movement
const step = direction === 'right' ? -200 : 200;
setTranslateX(prev => prev + step);
};
@ -250,12 +250,7 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
// If already scrolling, toggle speed, otherwise start scrolling
if (isScrolling) {
toggleSpeed('left');
} else {
startAutoScroll('left');
}
scroll('left');
}}
onMouseEnter={(e) => {
e.stopPropagation();
@ -276,12 +271,7 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
// If already scrolling, toggle speed, otherwise start scrolling
if (isScrolling) {
toggleSpeed('right');
} else {
startAutoScroll('right');
}
scroll('right');
}}
onMouseEnter={(e) => {
e.stopPropagation();
@ -338,14 +328,12 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
</button>
{/* Continuous flowing carousel - videos flow across entire width */}
<div className="overflow-hidden w-full">
<div className="overflow-hidden">
<div
className="flex space-x-2 md:space-x-3 pb-4"
className="flex space-x-4 pb-4"
style={{
transform: `translateX(${translateX}px)`,
willChange: 'transform',
transition: 'transform 0.3s ease',
width: 'max-content'
transition: 'transform 0.3s ease'
}}
>
{/* Many copies for true infinite scroll */}