Add interactive scrolling and navigation to video carousels

Update `SimpleCarousel` component to include left/right scroll buttons, implement infinite scrolling effect by duplicating video list, and refine visual styling for video cards.

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/kdQ95gE
This commit is contained in:
sebastjanartic 2025-08-29 20:21:41 +00:00
parent abb3f4492c
commit 5564863b27

View File

@ -96,33 +96,66 @@ export default function SimpleCarousel({ category, onVideoClick }: SimpleCarouse
}, [category.videos.length]);
return (
<div className="mb-12">
<div className="relative group mb-12">
<h2 className="oswald-text text-2xl text-bunny-light mb-6 px-4">
{category.title}
</h2>
<div className="px-4">
{/* Simple grid layout - videos next to each other */}
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4">
{category.videos.map((video, videoIndex) => (
<div key={video.id} className="relative">
{/* Top 10 Number overlay for first category */}
{category.title.includes("Top 10") && (
<div className="absolute top-1 left-1 z-30 text-white font-black text-2xl md:text-3xl drop-shadow-2xl pointer-events-none"
style={{
textShadow: '4px 4px 8px rgba(0,0,0,0.8), -2px -2px 4px rgba(0,0,0,0.6)',
WebkitTextStroke: '2px rgba(0,0,0,0.8)'
}}>
{videoIndex + 1}
<div className="relative">
{/* Left scroll button */}
<button
onClick={() => scroll('left')}
onMouseEnter={() => startAutoScroll('left')}
onMouseLeave={stopAutoScroll}
className="absolute left-2 top-[45%] -translate-y-1/2 w-12 h-12 z-[100] bg-black/80 hover:bg-black/95 rounded-full flex items-center justify-center transition-all duration-300 cursor-pointer border border-white/30 shadow-lg opacity-80 hover:!opacity-100"
>
<ChevronLeft className="w-6 h-6 text-white" />
</button>
{/* Right scroll button */}
<button
onClick={() => scroll('right')}
onMouseEnter={() => startAutoScroll('right')}
onMouseLeave={stopAutoScroll}
className="absolute right-2 top-[45%] -translate-y-1/2 w-12 h-12 z-[100] bg-black/80 hover:bg-black/95 rounded-full flex items-center justify-center transition-all duration-300 cursor-pointer border border-white/30 shadow-lg opacity-80 hover:!opacity-100"
>
<ChevronRight className="w-6 h-6 text-white" />
</button>
{/* Scroll container */}
<div
ref={scrollContainerRef}
className="overflow-x-auto pb-8"
style={{
scrollbarWidth: 'none',
msOverflowStyle: 'none'
}}
>
<div className="flex space-x-4 w-max">
{/* Create many copies for infinite feel */}
{Array.from({ length: 20 }).map((_, copyIndex) =>
category.videos.map((video, videoIndex) => (
<div key={`${video.id}-${copyIndex}-${videoIndex}`} className="flex-shrink-0 w-48 md:w-80 relative individual-video-hover">
{/* Top 10 Number overlay for first category */}
{category.title.includes("Top 10") && (
<div className="absolute top-1 left-1 z-30 text-white font-black text-3xl md:text-5xl drop-shadow-2xl pointer-events-none individual-video-hover:opacity-0 transition-opacity duration-300"
style={{
textShadow: '4px 4px 8px rgba(0,0,0,0.8), -2px -2px 4px rgba(0,0,0,0.6)',
WebkitTextStroke: '2px rgba(0,0,0,0.8)',
transform: 'none'
}}>
{videoIndex + 1}
</div>
)}
<VideoCard
video={video}
onClick={onVideoClick}
className="w-full hover:scale-105 transition-all duration-300 hover:shadow-2xl rounded-md overflow-hidden relative"
/>
</div>
)}
<VideoCard
video={video}
onClick={onVideoClick}
className="w-full hover:scale-105 transition-all duration-300 hover:shadow-2xl rounded-md overflow-hidden relative"
/>
</div>
))}
))
).flat()}
</div>
</div>
</div>
</div>