Improve video grid scrolling behavior when modal is open
Introduce a `hideScrollButtons` prop to `CategoryRow` in `netflix-grid.tsx` to conditionally render scroll buttons based on the `isModalOpen` state, preventing scroll button interference when a modal is active. 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/DVZN4Rp
This commit is contained in:
parent
971f3aadb0
commit
f10c46f0d8
BIN
attached_assets/image_1756564625261.png
Normal file
BIN
attached_assets/image_1756564625261.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@ -111,6 +111,7 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) {
|
|||||||
<CategoryRow
|
<CategoryRow
|
||||||
category={category}
|
category={category}
|
||||||
onVideoClick={handleVideoClick}
|
onVideoClick={handleVideoClick}
|
||||||
|
hideScrollButtons={isModalOpen}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
@ -130,9 +131,10 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) {
|
|||||||
interface CategoryRowProps {
|
interface CategoryRowProps {
|
||||||
category: VideoCategory;
|
category: VideoCategory;
|
||||||
onVideoClick: (video: Video) => void;
|
onVideoClick: (video: Video) => void;
|
||||||
|
hideScrollButtons?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
|
function CategoryRow({ category, onVideoClick, hideScrollButtons = false }: CategoryRowProps) {
|
||||||
const scrollRef = useRef<HTMLDivElement>(null);
|
const scrollRef = useRef<HTMLDivElement>(null);
|
||||||
const [isScrolling, setIsScrolling] = useState(false);
|
const [isScrolling, setIsScrolling] = useState(false);
|
||||||
const scrollIntervalRef = useRef<NodeJS.Timeout>();
|
const scrollIntervalRef = useRef<NodeJS.Timeout>();
|
||||||
@ -195,7 +197,8 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
|
|||||||
{category.title}
|
{category.title}
|
||||||
</h2>
|
</h2>
|
||||||
<div className="relative overflow-hidden">
|
<div className="relative overflow-hidden">
|
||||||
{/* Left scroll button - only on desktop */}
|
{/* Left scroll button - only on desktop and not hidden */}
|
||||||
|
{!hideScrollButtons && (
|
||||||
<Button
|
<Button
|
||||||
onClick={() => scroll('left')}
|
onClick={() => scroll('left')}
|
||||||
onMouseEnter={() => startAutoScroll('left')}
|
onMouseEnter={() => startAutoScroll('left')}
|
||||||
@ -205,8 +208,10 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
|
|||||||
>
|
>
|
||||||
<ChevronLeft className="w-5 h-5" />
|
<ChevronLeft className="w-5 h-5" />
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Right scroll button - only on desktop */}
|
{/* Right scroll button - only on desktop and not hidden */}
|
||||||
|
{!hideScrollButtons && (
|
||||||
<Button
|
<Button
|
||||||
onClick={() => scroll('right')}
|
onClick={() => scroll('right')}
|
||||||
onMouseEnter={() => startAutoScroll('right')}
|
onMouseEnter={() => startAutoScroll('right')}
|
||||||
@ -216,6 +221,7 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
|
|||||||
>
|
>
|
||||||
<ChevronRight className="w-5 h-5" />
|
<ChevronRight className="w-5 h-5" />
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Scrollable video row - true edge to edge */}
|
{/* Scrollable video row - true edge to edge */}
|
||||||
<div
|
<div
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user