feat: implement flatten course schedule helper function

takes a course schedule and returns an array of objects that can be used to render all the individual course
This commit is contained in:
Abhinav Chadaga
2024-02-17 14:30:59 -06:00
committed by doprz
parent cc7138949c
commit e54f488b17
3 changed files with 114 additions and 24 deletions

View File

@@ -13,9 +13,12 @@ const meta = {
},
tags: ['autodocs'],
argTypes: {
course: { control: 'object' },
meetingIdx: { control: 'number' },
colors: { control: 'object' },
department: { control: { type: 'text' } },
courseNumber: { control: { type: 'text' } },
instructorLastName: { control: { type: 'text' } },
status: { control: { type: 'select', options: Object.values(Status) } },
meetingTime: { control: { type: 'text' } },
colors: { control: { type: 'object' } },
},
render: (args: any) => (
<div className='w-45'>
@@ -23,8 +26,13 @@ const meta = {
</div>
),
args: {
course: exampleCourse,
meetingIdx: 0,
department: exampleCourse.department,
courseNumber: exampleCourse.number,
instructorLastName: exampleCourse.instructors[0].lastName,
status: exampleCourse.status,
meetingTime: exampleCourse.schedule.meetings[0].getTimeString({separator: '-'}),
colors: getCourseColors('emerald', 500),
},
} satisfies Meta<typeof CalendarCourseCell>;