@@ -3,15 +3,18 @@ import type { CourseOffering } from "../types";
33
44interface CourseSectionItemProps {
55 offering : CourseOffering ;
6+ selectedClassNumbers ?: number [ ] ;
67 onSelect ?: ( offering : CourseOffering ) => void ;
78 onHover ?: ( offering : CourseOffering | null ) => void ;
89}
910
1011export const CourseSectionItem = ( {
1112 offering,
13+ selectedClassNumbers,
1214 onSelect,
1315 onHover,
1416} : CourseSectionItemProps ) => {
17+ const isSelected = selectedClassNumbers ?. includes ( offering . classNumber ) ;
1518 return (
1619 < button
1720 type = "button"
@@ -29,18 +32,28 @@ export const CourseSectionItem = ({
2932 < span className = "font-semibold text-sm" >
3033 Section { offering . section }
3134 </ span >
32- < span
33- className = { clsx (
34- "text-xs px-2 py-1 rounded-full font-medium capitalize" ,
35- offering . status === "open" && "bg-green-100 text-green-800" ,
36- offering . status === "closed" && "bg-red-100 text-red-800" ,
37- offering . status === "waitlist" && "bg-yellow-100 text-yellow-800" ,
35+ < div className = "flex items-center gap-2" >
36+ { isSelected && (
37+ < span
38+ className = "text-xs px-2 py-1 rounded-full font-medium bg-violet-100 text-violet-800 dark:bg-violet-900
39+ dark:text-violet-200"
40+ >
41+ Selected
42+ </ span >
3843 ) }
39- >
40- { offering . status === "waitlist"
41- ? `Waitlist (${ offering . waitlistNum || 0 } )`
42- : offering . status }
43- </ span >
44+ < span
45+ className = { clsx (
46+ "text-xs px-2 py-1 rounded-full font-medium capitalize" ,
47+ offering . status === "open" && "bg-green-100 text-green-800" ,
48+ offering . status === "closed" && "bg-red-100 text-red-800" ,
49+ offering . status === "waitlist" && "bg-yellow-100 text-yellow-800" ,
50+ ) }
51+ >
52+ { offering . status === "waitlist"
53+ ? `Waitlist (${ offering . waitlistNum || 0 } )`
54+ : offering . status }
55+ </ span >
56+ </ div >
4457 </ div >
4558 < div className = "text-xs text-muted-foreground space-y-1" >
4659 < div > { offering . instructor } </ div >
0 commit comments