11"use client" ;
2-
3- import type { DayData } from "@/types/types" ; // Ensure you import the correct type
2+ import type { DayData } from "@/types/types" ;
43import { ChevronLeft , ChevronRight } from "lucide-react" ;
54import React from "react" ;
65import { timetableData } from "./TimeTableData" ;
@@ -12,48 +11,49 @@ type TimeTableSliderProps = {
1211 onNextDay : ( ) => void ;
1312} ;
1413
15- // Default empty schedule to prevent errors
1614const defaultDayData : DayData = { day : "No Data" , schedule : [ ] } ;
1715
1816export const TimeTableSlider = ( {
1917 currentDay,
2018 onPrevDay,
2119 onNextDay,
2220} : TimeTableSliderProps ) => {
23- // Ensure currentDay is within valid range
2421 const currentDayData : DayData = timetableData [ currentDay ] ?? defaultDayData ;
2522
2623 return (
27- < div className = "group relative h-fit w-full" >
28- < div className = "h-full overflow-hidden rounded-lg" >
29- < TimeTableDay day = { currentDayData } />
24+ < div className = "group relative w-full h-full min-h-0 flex flex-col" >
25+ { /* Main timetable content - expands to fill available space */ }
26+ < div className = "flex-1 min-h-0 overflow-hidden rounded-lg" >
27+ < div className = "w-full h-full" >
28+ < TimeTableDay day = { currentDayData } />
29+ </ div >
3030 </ div >
3131
3232 { /* Left Navigation Button */ }
3333 < button
34- type = "button" // Fixed missing type
34+ type = "button"
3535 onClick = { onPrevDay }
3636 disabled = { currentDay <= 0 }
37- className = "absolute left-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 opacity-0 transition-opacity disabled:opacity-50 group-hover:opacity-100"
37+ className = "absolute left-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 opacity-0 transition-opacity disabled:opacity-50 group-hover:opacity-100 z-10 "
3838 >
3939 < ChevronLeft className = "size-5 text-white" />
4040 </ button >
4141
4242 { /* Right Navigation Button */ }
4343 < button
44- type = "button" // Fixed missing type
44+ type = "button"
4545 onClick = { onNextDay }
4646 disabled = { currentDay >= timetableData . length - 1 }
47- className = "absolute right-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 opacity-0 transition-opacity disabled:opacity-50 group-hover:opacity-100"
47+ className = "absolute right-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 opacity-0 transition-opacity disabled:opacity-50 group-hover:opacity-100 z-10 "
4848 >
4949 < ChevronRight className = "size-5 text-white" />
5050 </ button >
5151
5252 { /* Pagination Indicators */ }
53- < div className = "absolute bottom-4 left-1/2 flex -translate-x-1/2 space-x-2" >
53+ < div className = "absolute bottom-4 left-1/2 flex -translate-x-1/2 space-x-2 z-10 " >
5454 { timetableData . map ( ( day , index ) => (
5555 < div
56- key = { day . day } // Use 'day.day' instead of index if it's unique
56+ key = { day . day }
5757 className = { `size-2 rounded-full ${
5858 currentDay === index ? "bg-black" : "bg-black/50"
5959 } `}
0 commit comments