From 13c69ef862f0214dfa6c9368fc3463519aa8f2f0 Mon Sep 17 00:00:00 2001 From: doprz <52579214+doprz@users.noreply.github.com> Date: Wed, 6 Mar 2024 13:47:34 -0600 Subject: [PATCH] fix: CalendarCourseCell spacing --- .../components/CalendarCourseCell.stories.tsx | 63 ++++++++----------- .../CalendarCourseCell/CalendarCourseCell.tsx | 21 ++++++- .../PopupCourseBlock/PopupCourseBlock.tsx | 18 +++--- 3 files changed, 57 insertions(+), 45 deletions(-) diff --git a/src/stories/components/CalendarCourseCell.stories.tsx b/src/stories/components/CalendarCourseCell.stories.tsx index cb68081d..4da0dcd1 100644 --- a/src/stories/components/CalendarCourseCell.stories.tsx +++ b/src/stories/components/CalendarCourseCell.stories.tsx @@ -39,40 +39,31 @@ export default meta; type Story = StoryObj; -export const Default: Story = { - args: { - course: new Course({ - uniqueId: 123, - number: '311C', - fullName: "311C - Bevo's Default Course", - courseName: "Bevo's Default Course", - department: 'BVO', - creditHours: 3, - status: Status.WAITLISTED, - instructors: [new Instructor({ firstName: '', lastName: 'Bevo', fullName: 'Bevo' })], - isReserved: false, - url: '', - flags: [], - schedule: new CourseSchedule({ - meetings: [ - new CourseMeeting({ - days: [DAY_MAP.M, DAY_MAP.W, DAY_MAP.F], - startTime: 480, - endTime: 570, - location: { - building: 'UTC', - room: '123', - }, - }), - ], - }), - instructionMode: 'In Person', - semester: { - year: 2024, - season: 'Spring', - }, - }), - meetingIdx: 0, - color: 'red', - }, +export const Default: Story = {}; + +export const Variants: Story = { + render: props => ( +
+ + + + +
+ ), }; diff --git a/src/views/components/common/CalendarCourseCell/CalendarCourseCell.tsx b/src/views/components/common/CalendarCourseCell/CalendarCourseCell.tsx index 1afb1b60..819d8142 100644 --- a/src/views/components/common/CalendarCourseCell/CalendarCourseCell.tsx +++ b/src/views/components/common/CalendarCourseCell/CalendarCourseCell.tsx @@ -1,4 +1,6 @@ -import { Status } from '@shared/types/Course'; +import { Course, Status } from '@shared/types/Course'; +import { CourseMeeting } from '@shared/types/CourseMeeting'; +import clsx from 'clsx'; import React from 'react'; import { CourseColors, pickFontColor } from 'src/shared/util/colors'; import ClosedIcon from '~icons/material-symbols/lock'; @@ -36,6 +38,7 @@ const CalendarCourseCell: React.FC = ({ course, meeting backgroundColor: colors.primaryColor, }} > +<<<<<<< HEAD
{courseDeptAndInstr} @@ -43,6 +46,22 @@ const CalendarCourseCell: React.FC = ({ course, meeting {timeAndLocation && ( {timeAndLocation} +======= +
+ + {course.department} {course.number} - {course.instructors[0].lastName} + + {meeting && ( + + {`${meeting.getTimeString({ separator: '–', capitalize: true })}${ + meeting.location ? ` – ${meeting.location.building}` : '' + }`} +>>>>>>> 73fe14e (fix calendar course cell spacing) )}
diff --git a/src/views/components/common/PopupCourseBlock/PopupCourseBlock.tsx b/src/views/components/common/PopupCourseBlock/PopupCourseBlock.tsx index 2d703caa..0f70d025 100644 --- a/src/views/components/common/PopupCourseBlock/PopupCourseBlock.tsx +++ b/src/views/components/common/PopupCourseBlock/PopupCourseBlock.tsx @@ -1,8 +1,8 @@ -import clsx from 'clsx'; -import React, { useState } from 'react'; import { Course, Status } from '@shared/types/Course'; +import { CourseColors, pickFontColor } from '@shared/util/colors'; import { StatusIcon } from '@shared/util/icons'; -import { CourseColors, getCourseColors, pickFontColor } from '@shared/util/colors'; +import clsx from 'clsx'; +import React from 'react'; import DragIndicatorIcon from '~icons/material-symbols/drag-indicator'; import Text from '../Text/Text'; @@ -21,7 +21,12 @@ export interface PopupCourseBlockProps { * * @param props PopupCourseBlockProps */ -export default function PopupCourseBlock({ className, course, colors, dragHandleProps }: PopupCourseBlockProps): JSX.Element { +export default function PopupCourseBlock({ + className, + course, + colors, + dragHandleProps, +}: PopupCourseBlockProps): JSX.Element { // whiteText based on secondaryColor const fontColor = pickFontColor(colors.primaryColor); @@ -41,10 +46,7 @@ export default function PopupCourseBlock({ className, course, colors, dragHandle >
- + {course.uniqueId} {course.department} {course.number} –{' '} {course.instructors.length === 0 ? 'Unknown' : course.instructors.map(v => v.lastName)}