import React from 'react'; import { Course } from 'src/shared/types/Course'; import { CourseMeeting } from 'src/shared/types/CourseMeeting'; import styles from './CalendarCourseMeeting.module.scss'; /** * Props for the CalendarCourseMeeting component. */ export interface CalendarCourseMeetingProps { /** 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; /** The icon to display on the right side of the course. This is optional. */ rightIcon?: React.ReactNode; } /** * `CalendarCourseMeeting` is a functional component that displays a course meeting. * * @example * } /> */ const CalendarCourseMeeting: React.FC = ({ course, meetingIdx, }: CalendarCourseMeetingProps) => { let meeting: CourseMeeting | null = meetingIdx !== undefined ? course.schedule.meetings[meetingIdx] : null; return (
{course.department} {course.number} - {course.instructors[0].lastName}
{`${meeting.getTimeString({ separator: '-', capitalize: true })}${ meeting.location ? ` - ${meeting.location.building}` : '' }`}
); }; export default CalendarCourseMeeting;