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

@ -12,7 +12,7 @@ import { UserData } from "@/types/auth";
interface HeaderProps {
displayUser?: boolean;
displaySubject?: string;
displayTabTitle: string;
displayTabTitle?: string;
examDuration?: string;
}
@ -109,18 +109,18 @@ const Header = ({
</div>
)}
{displaySubject && (
{displayTabTitle && (
<div className={styles.profile}>
<button onClick={handleBackClick} className={styles.iconButton}>
<ChevronLeft size={24} color="white" />
</button>
<span className={styles.text}>{displaySubject}</span>
<span className={styles.text}>{displayTabTitle}</span>
</div>
)}
{displayTabTitle && (
{displaySubject && (
<div className={styles.profile}>
<span className={styles.text}>{displayTabTitle}</span>
<span className={styles.text}>{displaySubject}</span>
</div>
)}

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;