fix(ts): fix interfaces for type safety

This commit is contained in:
shafin-r
2025-07-27 13:41:02 +06:00
parent 3ef526ec1a
commit e091a78bdb
8 changed files with 54 additions and 31 deletions

View File

@ -3,6 +3,19 @@ import Link from "next/link";
import Image from "next/image";
import styles from "../css/SlidingGallery.module.css";
interface SlidingGalleryProps {
views?: {
id: string;
content: React.ReactNode;
}[];
className?: string;
showPagination?: boolean;
autoScroll?: boolean;
autoScrollInterval?: number;
onSlideChange?: (currentIndex: number) => void;
height?: string | number;
}
const SlidingGallery = ({
views = [],
className = "",
@ -11,7 +24,7 @@ const SlidingGallery = ({
autoScrollInterval = 5000,
onSlideChange = () => {},
height = "100vh",
}) => {
}: SlidingGalleryProps) => {
const [activeIdx, setActiveIdx] = useState(0);
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
const scrollRef = useRef(null);
@ -74,7 +87,7 @@ const SlidingGallery = ({
}
}, [dimensions]);
const handleScroll = (event) => {
const handleScroll = (event: { target: { scrollLeft: any } }) => {
handleUserInteraction();
const scrollLeft = event.target.scrollLeft;
const slideWidth = dimensions.width;