fix: CalendarCourseCell spacing
This commit is contained in:
@@ -39,40 +39,31 @@ export default meta;
|
|||||||
|
|
||||||
type Story = StoryObj<typeof meta>;
|
type Story = StoryObj<typeof meta>;
|
||||||
|
|
||||||
export const Default: Story = {
|
export const Default: Story = {};
|
||||||
args: {
|
|
||||||
course: new Course({
|
export const Variants: Story = {
|
||||||
uniqueId: 123,
|
render: props => (
|
||||||
number: '311C',
|
<div className='grid grid-cols-2 h-40 max-w-60 w-90vw gap-x-4 gap-y-2'>
|
||||||
fullName: "311C - Bevo's Default Course",
|
<CalendarCourseCell
|
||||||
courseName: "Bevo's Default Course",
|
{...props}
|
||||||
department: 'BVO',
|
course={new Course({ ...exampleCourse, status: Status.OPEN })}
|
||||||
creditHours: 3,
|
colors={getCourseColors('green', 500)}
|
||||||
status: Status.WAITLISTED,
|
/>
|
||||||
instructors: [new Instructor({ firstName: '', lastName: 'Bevo', fullName: 'Bevo' })],
|
<CalendarCourseCell
|
||||||
isReserved: false,
|
{...props}
|
||||||
url: '',
|
course={new Course({ ...exampleCourse, status: Status.CLOSED })}
|
||||||
flags: [],
|
colors={getCourseColors('teal', 400)}
|
||||||
schedule: new CourseSchedule({
|
/>
|
||||||
meetings: [
|
<CalendarCourseCell
|
||||||
new CourseMeeting({
|
{...props}
|
||||||
days: [DAY_MAP.M, DAY_MAP.W, DAY_MAP.F],
|
course={new Course({ ...exampleCourse, status: Status.WAITLISTED })}
|
||||||
startTime: 480,
|
colors={getCourseColors('indigo', 400)}
|
||||||
endTime: 570,
|
/>
|
||||||
location: {
|
<CalendarCourseCell
|
||||||
building: 'UTC',
|
{...props}
|
||||||
room: '123',
|
course={new Course({ ...exampleCourse, status: Status.CANCELLED })}
|
||||||
},
|
colors={getCourseColors('red', 500)}
|
||||||
}),
|
/>
|
||||||
],
|
</div>
|
||||||
}),
|
),
|
||||||
instructionMode: 'In Person',
|
|
||||||
semester: {
|
|
||||||
year: 2024,
|
|
||||||
season: 'Spring',
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
meetingIdx: 0,
|
|
||||||
color: 'red',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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 React from 'react';
|
||||||
import { CourseColors, pickFontColor } from 'src/shared/util/colors';
|
import { CourseColors, pickFontColor } from 'src/shared/util/colors';
|
||||||
import ClosedIcon from '~icons/material-symbols/lock';
|
import ClosedIcon from '~icons/material-symbols/lock';
|
||||||
@@ -36,6 +38,7 @@ const CalendarCourseCell: React.FC<CalendarCourseCellProps> = ({ course, meeting
|
|||||||
backgroundColor: colors.primaryColor,
|
backgroundColor: colors.primaryColor,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<<<<<<< HEAD
|
||||||
<div className='flex flex-1 flex-col gap-1'>
|
<div className='flex flex-1 flex-col gap-1'>
|
||||||
<Text variant='h1-course' className='leading-[75%]!'>
|
<Text variant='h1-course' className='leading-[75%]!'>
|
||||||
{courseDeptAndInstr}
|
{courseDeptAndInstr}
|
||||||
@@ -43,6 +46,22 @@ const CalendarCourseCell: React.FC<CalendarCourseCellProps> = ({ course, meeting
|
|||||||
{timeAndLocation && (
|
{timeAndLocation && (
|
||||||
<Text variant='h3-course' className='leading-[75%]!'>
|
<Text variant='h3-course' className='leading-[75%]!'>
|
||||||
{timeAndLocation}
|
{timeAndLocation}
|
||||||
|
=======
|
||||||
|
<div className='flex flex-1 flex-col gap-1 overflow-x-hidden'>
|
||||||
|
<Text
|
||||||
|
variant='h1-course'
|
||||||
|
className={clsx('-my-0.8 leading-tight', {
|
||||||
|
truncate: meeting,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{course.department} {course.number} - {course.instructors[0].lastName}
|
||||||
|
</Text>
|
||||||
|
{meeting && (
|
||||||
|
<Text variant='h3-course' className='-mb-0.5'>
|
||||||
|
{`${meeting.getTimeString({ separator: '–', capitalize: true })}${
|
||||||
|
meeting.location ? ` – ${meeting.location.building}` : ''
|
||||||
|
}`}
|
||||||
|
>>>>>>> 73fe14e (fix calendar course cell spacing)
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import clsx from 'clsx';
|
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { Course, Status } from '@shared/types/Course';
|
import { Course, Status } from '@shared/types/Course';
|
||||||
|
import { CourseColors, pickFontColor } from '@shared/util/colors';
|
||||||
import { StatusIcon } from '@shared/util/icons';
|
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 DragIndicatorIcon from '~icons/material-symbols/drag-indicator';
|
||||||
import Text from '../Text/Text';
|
import Text from '../Text/Text';
|
||||||
|
|
||||||
@@ -21,7 +21,12 @@ export interface PopupCourseBlockProps {
|
|||||||
*
|
*
|
||||||
* @param props 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
|
// whiteText based on secondaryColor
|
||||||
const fontColor = pickFontColor(colors.primaryColor);
|
const fontColor = pickFontColor(colors.primaryColor);
|
||||||
|
|
||||||
@@ -41,10 +46,7 @@ export default function PopupCourseBlock({ className, course, colors, dragHandle
|
|||||||
>
|
>
|
||||||
<DragIndicatorIcon className='h-6 w-6 text-white' />
|
<DragIndicatorIcon className='h-6 w-6 text-white' />
|
||||||
</div>
|
</div>
|
||||||
<Text
|
<Text className={clsx('flex-1 py-3.5 truncate', fontColor)} variant='h1-course'>
|
||||||
className={clsx('flex-1 py-3.5 text-ellipsis whitespace-nowrap overflow-hidden', fontColor)}
|
|
||||||
variant='h1-course'
|
|
||||||
>
|
|
||||||
<span className='px-0.5 font-450'>{course.uniqueId}</span> {course.department} {course.number} –{' '}
|
<span className='px-0.5 font-450'>{course.uniqueId}</span> {course.department} {course.number} –{' '}
|
||||||
{course.instructors.length === 0 ? 'Unknown' : course.instructors.map(v => v.lastName)}
|
{course.instructors.length === 0 ? 'Unknown' : course.instructors.map(v => v.lastName)}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user