chore: WIP

This commit is contained in:
doprz
2024-03-06 15:01:59 -06:00
parent ad18fbd162
commit e95ac42d57
2 changed files with 41 additions and 7 deletions

View File

@@ -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/Calendar', title: 'Components/Common/Calendar',
@@ -16,10 +19,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,
}, },
}; };

View File

@@ -1,10 +1,9 @@
import React, {useRef} from 'react'; import React, {useRef} from 'react';
import html2canvas from 'html2canvas'; import html2canvas from 'html2canvas';
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';
import calIcon from 'src/assets/icons/cal.svg'; import calIcon from 'src/assets/icons/cal.svg';
import pngIcon from 'src/assets/icons/png.svg'; import pngIcon from 'src/assets/icons/png.svg';
@@ -78,15 +77,16 @@ function CalendarGrid({ courseCells, saturdayClass }: React.PropsWithChildren<Pr
))} ))}
</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 className={styles.buttonContainer}> <div className={styles.buttonContainer}>