WIP
This commit is contained in:
@@ -32,7 +32,6 @@ const meta = {
|
|||||||
status: exampleCourse.status,
|
status: exampleCourse.status,
|
||||||
meetingTime: exampleCourse.schedule.meetings[0].getTimeString({ separator: '-' }),
|
meetingTime: exampleCourse.schedule.meetings[0].getTimeString({ separator: '-' }),
|
||||||
|
|
||||||
|
|
||||||
colors: getCourseColors('emerald', 500),
|
colors: getCourseColors('emerald', 500),
|
||||||
},
|
},
|
||||||
} satisfies Meta<typeof CalendarCourseCell>;
|
} satisfies Meta<typeof CalendarCourseCell>;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import { Meta, StoryObj } from '@storybook/react';
|
import { Meta, StoryObj } from '@storybook/react';
|
||||||
import CalendarGrid from 'src/views/components/common/CalendarGrid/CalendarGrid';
|
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 = {
|
const meta = {
|
||||||
title: 'Components/Common/CalendarGrid',
|
title: 'Components/Common/CalendarGrid',
|
||||||
@@ -14,10 +17,41 @@ const meta = {
|
|||||||
} satisfies Meta<typeof CalendarGrid>;
|
} satisfies Meta<typeof CalendarGrid>;
|
||||||
export default 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<typeof meta>;
|
type Story = StoryObj<typeof meta>;
|
||||||
|
|
||||||
export const Default: Story = {
|
export const Default: Story = {
|
||||||
args: {
|
args: {
|
||||||
saturdayClass: true,
|
saturdayClass: true,
|
||||||
|
courseCells: testData,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { DAY_MAP } from 'src/shared/types/CourseMeeting';
|
import { DAY_MAP } from 'src/shared/types/CourseMeeting';
|
||||||
import CalendarCell from '../CalendarGridCell/CalendarGridCell';
|
|
||||||
import { CalendarGridCourse } from 'src/views/hooks/useFlattenedCourseSchedule';
|
import { CalendarGridCourse } from 'src/views/hooks/useFlattenedCourseSchedule';
|
||||||
|
import CalendarCell from '../CalendarGridCell/CalendarGridCell';
|
||||||
import CalendarCourseCell from '../CalendarCourseCell/CalendarCourseCell';
|
import CalendarCourseCell from '../CalendarCourseCell/CalendarCourseCell';
|
||||||
import { Chip } from '../Chip/Chip';
|
|
||||||
import styles from './CalendarGrid.module.scss';
|
import styles from './CalendarGrid.module.scss';
|
||||||
|
|
||||||
const daysOfWeek = Object.keys(DAY_MAP).filter(key => !['S', 'SU'].includes(key));
|
const daysOfWeek = Object.keys(DAY_MAP).filter(key => !['S', 'SU'].includes(key));
|
||||||
@@ -59,15 +58,16 @@ function CalendarGrid({ courseCells, saturdayClass }: React.PropsWithChildren<Pr
|
|||||||
{grid.map(row => row)}
|
{grid.map(row => row)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{courseCells.map((Block: typeof CalendarCourseCell) => (
|
{courseCells.map((block: CalendarGridCourse) => (
|
||||||
<div
|
<div
|
||||||
key={`${Block}`}
|
key={`${block}`}
|
||||||
style={{
|
style={{
|
||||||
gridColumn: `1`,
|
gridColumn: `${block.calendarGridPoint.dayIndex}`,
|
||||||
gridRow: `1`,
|
gridRow: `${block.calendarGridPoint.startIndex} / ${block.calendarGridPoint.endIndex}`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CalendarCourseCell courseDeptAndInstr={} />
|
<CalendarCourseCell courseDeptAndInstr={block.componentProps.courseDeptAndInstr}
|
||||||
|
status={block.componentProps.status} colors={block.componentProps.colors}/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user