Merge branch 'hackathon' of https://github.com/ut-developers/UT-Registration-Plus into hackathon
This commit is contained in:
@@ -44,7 +44,7 @@ export const Default: Story = {};
|
||||
|
||||
export const Variants: Story = {
|
||||
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
|
||||
{...props}
|
||||
course={new Course({ ...exampleCourse, status: Status.OPEN })}
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
// Calendar.stories.tsx
|
||||
import React from 'react';
|
||||
import Calendar from '@views/components/common/CalendarGrid/CalendarGrid';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
import CalendarGrid from 'src/views/components/common/CalendarGrid/CalendarGrid';
|
||||
|
||||
const meta = {
|
||||
title: 'Components/Common/Calendar',
|
||||
component: Calendar,
|
||||
title: 'Components/Common/CalendarGrid',
|
||||
component: CalendarGrid,
|
||||
parameters: {
|
||||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
}
|
||||
} satisfies Meta<typeof Calendar>;
|
||||
|
||||
argTypes: {
|
||||
saturdayClass: { control: 'boolean' },
|
||||
},
|
||||
} satisfies Meta<typeof CalendarGrid>;
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {};
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
saturdayClass: true,
|
||||
},
|
||||
};
|
||||
17
src/stories/components/CalendarHeader.stories.tsx
Normal file
17
src/stories/components/CalendarHeader.stories.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
import CalendarHeader from '@views/components/common/CalendarHeader/CalenderHeader';
|
||||
|
||||
const meta = {
|
||||
title: 'Components/CalendarHeader',
|
||||
component: CalendarHeader,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
} satisfies Meta<typeof CalendarHeader>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {};
|
||||
@@ -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';
|
||||
@@ -38,12 +40,17 @@ const CalendarCourseCell: React.FC<CalendarCourseCellProps> = ({
|
||||
backgroundColor: colors.primaryColor,
|
||||
}}
|
||||
>
|
||||
<div className='flex flex-1 flex-col gap-1'>
|
||||
<Text variant='h1-course' className='leading-[75%]!'>
|
||||
{courseDeptAndInstr}
|
||||
<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>
|
||||
{timeAndLocation && (
|
||||
<Text variant='h3-course' className='leading-[75%]!'>
|
||||
<Text variant='h3-course' className='-mb-0.5'>
|
||||
{timeAndLocation}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
@@ -2,7 +2,8 @@ import React from 'react';
|
||||
import { DAY_MAP } from 'src/shared/types/CourseMeeting';
|
||||
import styles from './CalendarGrid.module.scss';
|
||||
import CalendarCell from '../CalendarGridCell/CalendarGridCell';
|
||||
import { CourseMeeting } from 'src/shared/types/CourseMeeting';
|
||||
import CalendarCourseCell from '../CalendarCourseCell/CalendarCourseCell';
|
||||
import { Chip } from '../Chip/Chip';
|
||||
|
||||
const daysOfWeek = Object.keys(DAY_MAP).filter(key => !['S', 'SU'].includes(key));
|
||||
const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8);
|
||||
@@ -22,15 +23,15 @@ for (let i = 0; i < 13; i++) {
|
||||
}
|
||||
|
||||
interface Props {
|
||||
CourseMeetingBlocks: CourseMeeting[];
|
||||
courseCells: any[];
|
||||
saturdayClass: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grid of CalendarGridCell components forming the user's course schedule calendar view
|
||||
* @param props
|
||||
*/
|
||||
export function Calendar({ courseMeetingBlocks }: React.PropsWithChildren<Props>): JSX.Element {
|
||||
|
||||
function CalendarGrid({ courseCells, saturdayClass }: React.PropsWithChildren<Props> ): JSX.Element {
|
||||
return (
|
||||
<div className={styles.calendar}>
|
||||
<div className={styles.dayLabelContainer} />
|
||||
@@ -54,16 +55,22 @@ export function Calendar({ courseMeetingBlocks }: React.PropsWithChildren<Props>
|
||||
{day}
|
||||
</div>
|
||||
))}
|
||||
{grid.map((row, rowIndex) => row)}
|
||||
{grid.map(row => row)}
|
||||
</div>
|
||||
</div>
|
||||
{courseMeetingBlocks.map((block: CourseMeeting, index: number) => (
|
||||
<div key={index}>
|
||||
{block}
|
||||
{/* courseCells.map((Block: typeof CalendarCourseCell) => (
|
||||
<div
|
||||
key={`${Block}`}
|
||||
style={{
|
||||
gridColumn: `1`,
|
||||
gridRow: `1`,
|
||||
}}
|
||||
>
|
||||
<Chip label='test' />
|
||||
</div>
|
||||
))}
|
||||
)) */}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export default Calendar;
|
||||
export default CalendarGrid;
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import React from 'react';
|
||||
import { Status } from '@shared/types/Course';
|
||||
import Divider from '../Divider/Divider';
|
||||
import { Button } from '../Button/Button';
|
||||
import Text from '../Text/Text';
|
||||
import MenuIcon from '~icons/material-symbols/menu';
|
||||
import LogoIcon from '~icons/material-symbols/add-circle-outline';
|
||||
import UndoIcon from '~icons/material-symbols/undo';
|
||||
import RedoIcon from '~icons/material-symbols/redo';
|
||||
import SettingsIcon from '~icons/material-symbols/settings';
|
||||
import ScheduleTotalHoursAndCourses from '../ScheduleTotalHoursAndCourses/ScheduleTotalHoursAndCourses';
|
||||
import CourseStatus from '../CourseStatus/CourseStatus';
|
||||
|
||||
const CalendarHeader = () => (
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
minWidth: '672px',
|
||||
minHeight: '79px',
|
||||
padding: '15px 0px',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
alignContent: 'center',
|
||||
rowGap: '10px',
|
||||
alignSelf: 'stretch',
|
||||
flexWrap: 'wrap',
|
||||
}}
|
||||
>
|
||||
<Button variant='single' icon={MenuIcon} color='ut-gray' />
|
||||
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<LogoIcon style={{ marginRight: '5px' }} />
|
||||
<Text>Your Logo Text</Text>
|
||||
</div>
|
||||
|
||||
<ScheduleTotalHoursAndCourses scheduleName='SCHEDULE' totalHours={22} totalCourses={8} />
|
||||
|
||||
<CourseStatus size='small' status={Status.WAITLISTED} />
|
||||
<CourseStatus size='small' status={Status.CLOSED} />
|
||||
<CourseStatus size='small' status={Status.CANCELLED} />
|
||||
|
||||
<div style={{ display: 'flex' }}>
|
||||
<Button variant='outline' icon={UndoIcon} color='ut-black' />
|
||||
<Button variant='outline' icon={RedoIcon} color='ut-black' />
|
||||
</div>
|
||||
|
||||
<Button variant='outline' icon={SettingsIcon} color='ut-black' />
|
||||
|
||||
<Divider type='solid' />
|
||||
</div>
|
||||
);
|
||||
|
||||
export default CalendarHeader;
|
||||
@@ -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
|
||||
>
|
||||
<DragIndicatorIcon className='h-6 w-6 text-white' />
|
||||
</div>
|
||||
<Text
|
||||
className={clsx('flex-1 py-3.5 text-ellipsis whitespace-nowrap overflow-hidden', fontColor)}
|
||||
variant='h1-course'
|
||||
>
|
||||
<Text className={clsx('flex-1 py-3.5 truncate', fontColor)} variant='h1-course'>
|
||||
<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)}
|
||||
</Text>
|
||||
|
||||
@@ -15,27 +15,19 @@ export interface ScheduleTotalHoursAndCoursesProps {
|
||||
*
|
||||
* @param props ScheduleTotalHoursAndCoursesProps
|
||||
*/
|
||||
export default function ScheduleTotalHoursAndCoursess({ scheduleName, totalHours, totalCourses }: ScheduleTotalHoursAndCoursesProps): JSX.Element {
|
||||
export default function ScheduleTotalHoursAndCourses({
|
||||
scheduleName,
|
||||
totalHours,
|
||||
totalCourses,
|
||||
}: ScheduleTotalHoursAndCoursesProps): JSX.Element {
|
||||
return (
|
||||
<div className="min-w-64 flex flex-wrap content-center items-baseline gap-2 uppercase">
|
||||
<Text
|
||||
className="text-[#BF5700]"
|
||||
variant='h1'
|
||||
as='span'
|
||||
>
|
||||
<div className='min-w-64 flex flex-wrap content-center items-baseline gap-2 uppercase'>
|
||||
<Text className='text-[#BF5700]' variant='h1' as='span'>
|
||||
{`${scheduleName}: `}
|
||||
</Text>
|
||||
<Text
|
||||
variant='h3'
|
||||
as='div'
|
||||
className="flex flex-row items-center gap-2 text-[#1A2024]"
|
||||
>
|
||||
<Text variant='h3' as='div' className='flex flex-row items-center gap-2 text-[#1A2024]'>
|
||||
{`${totalHours} HOURS`}
|
||||
<Text
|
||||
variant='h4'
|
||||
as='span'
|
||||
className="text-[#333F48]"
|
||||
>
|
||||
<Text variant='h4' as='span' className='text-[#333F48]'>
|
||||
{`${totalCourses} courses`}
|
||||
</Text>
|
||||
</Text>
|
||||
|
||||
Reference in New Issue
Block a user