feat: play page && other refactor

This commit is contained in:
shinya
2025-06-19 02:40:39 +08:00
parent 3d199261a3
commit d01bc68d75
12 changed files with 1408 additions and 75 deletions

View File

@@ -3,9 +3,13 @@ import { useEffect, useRef, useState } from 'react';
interface ScrollableRowProps {
children: React.ReactNode;
scrollDistance?: number;
}
export default function ScrollableRow({ children }: ScrollableRowProps) {
export default function ScrollableRow({
children,
scrollDistance = 1000,
}: ScrollableRowProps) {
const containerRef = useRef<HTMLDivElement>(null);
const [showLeftScroll, setShowLeftScroll] = useState(false);
const [showRightScroll, setShowRightScroll] = useState(false);
@@ -70,13 +74,19 @@ export default function ScrollableRow({ children }: ScrollableRowProps) {
const handleScrollRightClick = () => {
if (containerRef.current) {
containerRef.current.scrollBy({ left: 1000, behavior: 'smooth' });
containerRef.current.scrollBy({
left: scrollDistance,
behavior: 'smooth',
});
}
};
const handleScrollLeftClick = () => {
if (containerRef.current) {
containerRef.current.scrollBy({ left: -1000, behavior: 'smooth' });
containerRef.current.scrollBy({
left: -scrollDistance,
behavior: 'smooth',
});
}
};