fix calendar course cell spacing
This commit is contained in:
@@ -36,7 +36,7 @@ export const Default: Story = {};
|
|||||||
|
|
||||||
export const Variants: Story = {
|
export const Variants: Story = {
|
||||||
render: props => (
|
render: props => (
|
||||||
<div className='grid grid-cols-2 h-40 max-w-xl w-90vw gap-x-4 gap-y-2'>
|
<div className='grid grid-cols-2 h-40 max-w-60 w-90vw gap-x-4 gap-y-2'>
|
||||||
<CalendarCourseCell
|
<CalendarCourseCell
|
||||||
{...props}
|
{...props}
|
||||||
course={new Course({ ...exampleCourse, status: Status.OPEN })}
|
course={new Course({ ...exampleCourse, status: Status.OPEN })}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Course, Status } from '@shared/types/Course';
|
import { Course, Status } from '@shared/types/Course';
|
||||||
import { CourseMeeting } from '@shared/types/CourseMeeting';
|
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';
|
||||||
@@ -40,16 +41,22 @@ const CalendarCourseBlock: React.FC<CalendarCourseBlockProps> = ({
|
|||||||
backgroundColor: colors.primaryColor,
|
backgroundColor: colors.primaryColor,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className='flex flex-1 flex-col gap-1'>
|
<div className='flex flex-1 flex-col gap-1 overflow-x-hidden'>
|
||||||
<Text variant='h1-course' className='leading-[75%]!'>
|
<Text
|
||||||
|
variant='h1-course'
|
||||||
|
className={clsx('-my-0.8 leading-tight', {
|
||||||
|
truncate: meeting,
|
||||||
|
})}
|
||||||
|
>
|
||||||
{course.department} {course.number} - {course.instructors[0].lastName}
|
{course.department} {course.number} - {course.instructors[0].lastName}
|
||||||
</Text>
|
</Text>
|
||||||
<Text variant='h3-course' className='leading-[75%]!'>
|
{meeting && (
|
||||||
{meeting &&
|
<Text variant='h3-course' className='-mb-0.5'>
|
||||||
`${meeting.getTimeString({ separator: '–', capitalize: true })}${
|
{`${meeting.getTimeString({ separator: '–', capitalize: true })}${
|
||||||
meeting.location ? ` – ${meeting.location.building}` : ''
|
meeting.location ? ` – ${meeting.location.building}` : ''
|
||||||
}`}
|
}`}
|
||||||
</Text>
|
</Text>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{rightIcon && (
|
{rightIcon && (
|
||||||
<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