import { Status } from '@shared/types/Course'; import React from 'react'; import { CourseColors, pickFontColor } from 'src/shared/util/colors'; import ClosedIcon from '~icons/material-symbols/lock'; import WaitlistIcon from '~icons/material-symbols/timelapse'; import CancelledIcon from '~icons/material-symbols/warning'; import Text from '../Text/Text'; export interface CalendarCourseCellProps { /** The Course that the meeting is for. */ course: Course; /* index into course meeting array to display */ meetingIdx?: number; /** The background color for the course. */ color: string; } const CalendarCourseCell: React.FC = ({ course, meetingIdx }: CalendarCourseCellProps) => { let meeting: CourseMeeting | null = meetingIdx !== undefined ? course.schedule.meetings[meetingIdx] : null; let rightIcon: React.ReactNode | null = null; if (status === Status.WAITLISTED) { rightIcon = ; } else if (status === Status.CLOSED) { rightIcon = ; } else if (status === Status.CANCELLED) { rightIcon = ; } // whiteText based on secondaryColor const fontColor = pickFontColor(colors.primaryColor); return (
{courseDeptAndInstr} {timeAndLocation && ( {timeAndLocation} )}
{rightIcon && (
{rightIcon}
)}
); }; export default CalendarCourseCell;