From d69e3435cf03d6cf199d8e7d88efe506c40ecf3f Mon Sep 17 00:00:00 2001 From: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Sat, 17 Feb 2024 15:32:42 -0600 Subject: [PATCH] WIP --- .../components/CalendarCourseCell.stories.tsx | 3 +- .../components/CalendarGrid.stories.tsx | 34 +++++++++++++++++++ .../common/CalendarGrid/CalendarGrid.tsx | 14 ++++---- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/stories/components/CalendarCourseCell.stories.tsx b/src/stories/components/CalendarCourseCell.stories.tsx index da37edf1..4da0dcd1 100644 --- a/src/stories/components/CalendarCourseCell.stories.tsx +++ b/src/stories/components/CalendarCourseCell.stories.tsx @@ -30,8 +30,7 @@ const meta = { courseNumber: exampleCourse.number, instructorLastName: exampleCourse.instructors[0].lastName, status: exampleCourse.status, - meetingTime: exampleCourse.schedule.meetings[0].getTimeString({separator: '-'}), - + meetingTime: exampleCourse.schedule.meetings[0].getTimeString({ separator: '-' }), colors: getCourseColors('emerald', 500), }, diff --git a/src/stories/components/CalendarGrid.stories.tsx b/src/stories/components/CalendarGrid.stories.tsx index 26fa245e..4e5d1ff8 100644 --- a/src/stories/components/CalendarGrid.stories.tsx +++ b/src/stories/components/CalendarGrid.stories.tsx @@ -1,5 +1,8 @@ import { Meta, StoryObj } from '@storybook/react'; import CalendarGrid from 'src/views/components/common/CalendarGrid/CalendarGrid'; +import { getCourseColors } from 'src/shared/util/colors'; +import { CalendarGridCourse } from 'src/views/hooks/useFlattenedCourseSchedule'; +import { Status } from 'src/shared/types/Course'; const meta = { title: 'Components/Common/CalendarGrid', @@ -14,10 +17,41 @@ const meta = { } satisfies Meta; export default meta; +const testData: CalendarGridCourse[] = [ + { + calendarGridPoint: { + dayIndex: 0, + startIndex: 1, + endIndex: 2, + }, + componentProps: { + courseDeptAndInstr: 'Course 1', + timeAndLocation: '9:00 AM - 10:00 AM, Room 101', + status: Status.OPEN, + colors: getCourseColors('emerald', 500), + }, + }, + { + calendarGridPoint: { + dayIndex: 1, + startIndex: 2, + endIndex: 3, + }, + componentProps: { + courseDeptAndInstr: 'Course 2', + timeAndLocation: '10:00 AM - 11:00 AM, Room 102', + status: Status.CLOSED, + colors: getCourseColors('emerald', 500), + }, + }, + // add more data as needed +]; + type Story = StoryObj; export const Default: Story = { args: { saturdayClass: true, + courseCells: testData, }, }; \ No newline at end of file diff --git a/src/views/components/common/CalendarGrid/CalendarGrid.tsx b/src/views/components/common/CalendarGrid/CalendarGrid.tsx index 0e478921..7542e292 100644 --- a/src/views/components/common/CalendarGrid/CalendarGrid.tsx +++ b/src/views/components/common/CalendarGrid/CalendarGrid.tsx @@ -1,9 +1,8 @@ import React from 'react'; import { DAY_MAP } from 'src/shared/types/CourseMeeting'; -import CalendarCell from '../CalendarGridCell/CalendarGridCell'; import { CalendarGridCourse } from 'src/views/hooks/useFlattenedCourseSchedule'; +import CalendarCell from '../CalendarGridCell/CalendarGridCell'; import CalendarCourseCell from '../CalendarCourseCell/CalendarCourseCell'; -import { Chip } from '../Chip/Chip'; import styles from './CalendarGrid.module.scss'; const daysOfWeek = Object.keys(DAY_MAP).filter(key => !['S', 'SU'].includes(key)); @@ -59,15 +58,16 @@ function CalendarGrid({ courseCells, saturdayClass }: React.PropsWithChildren row)} - {courseCells.map((Block: typeof CalendarCourseCell) => ( + {courseCells.map((block: CalendarGridCourse) => (
- +
))}