Improve video browsing experience with adaptive scrolling and full-width display
Adjusts `CategoryRow` component to utilize viewport width for scroll amounts and applies responsive widths to video cards, enhancing horizontal navigation across different screen sizes. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 074b0e4c-6171-43bd-aa98-f9e04623ca14 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/074b0e4c-6171-43bd-aa98-f9e04623ca14/6upLu3q
This commit is contained in:
parent
30b8be3502
commit
50fa13147f
@ -136,20 +136,9 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
|
|||||||
|
|
||||||
const scroll = (direction: 'left' | 'right') => {
|
const scroll = (direction: 'left' | 'right') => {
|
||||||
if (scrollRef.current) {
|
if (scrollRef.current) {
|
||||||
// Responsive scroll amount - different sizes for mobile/tablet/desktop
|
// Viewport-based scroll amount for full-width cards
|
||||||
const width = window.innerWidth;
|
const containerWidth = scrollRef.current.clientWidth;
|
||||||
let scrollAmount;
|
const scrollAmount = containerWidth * 0.8; // Scroll 80% of visible area
|
||||||
|
|
||||||
if (width < 640) {
|
|
||||||
// Mobile: smaller cards (176px + gap)
|
|
||||||
scrollAmount = 192;
|
|
||||||
} else if (width < 768) {
|
|
||||||
// Small tablet: medium cards (224px + gap)
|
|
||||||
scrollAmount = 240;
|
|
||||||
} else {
|
|
||||||
// Desktop: large cards (320px + gap)
|
|
||||||
scrollAmount = 336;
|
|
||||||
}
|
|
||||||
|
|
||||||
const currentScroll = scrollRef.current.scrollLeft;
|
const currentScroll = scrollRef.current.scrollLeft;
|
||||||
const targetScroll = direction === 'left'
|
const targetScroll = direction === 'left'
|
||||||
@ -188,14 +177,14 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
|
|||||||
<ChevronRight className="w-5 h-5" />
|
<ChevronRight className="w-5 h-5" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{/* Scrollable video row */}
|
{/* Scrollable video row - full width edge to edge */}
|
||||||
<div
|
<div
|
||||||
ref={scrollRef}
|
ref={scrollRef}
|
||||||
className="flex space-x-4 overflow-x-auto scrollbar-hide pb-4"
|
className="flex space-x-3 overflow-x-auto scrollbar-hide pb-4 px-4"
|
||||||
style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' }}
|
style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' }}
|
||||||
>
|
>
|
||||||
{category.videos.map((video, index) => (
|
{category.videos.map((video, index) => (
|
||||||
<div key={video.id} className="flex-shrink-0 w-44 sm:w-56 md:w-80 relative group">
|
<div key={video.id} className="flex-shrink-0 w-[45vw] sm:w-[35vw] md:w-[22vw] lg:w-[18vw] relative group">
|
||||||
{/* Top 10 Number overlay for first category */}
|
{/* Top 10 Number overlay for first category */}
|
||||||
{category.title.includes("Top 10") && index < 10 && (
|
{category.title.includes("Top 10") && index < 10 && (
|
||||||
<div className="absolute top-2 left-2 z-20 text-white font-black text-4xl sm:text-5xl md:text-7xl drop-shadow-2xl"
|
<div className="absolute top-2 left-2 z-20 text-white font-black text-4xl sm:text-5xl md:text-7xl drop-shadow-2xl"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user