-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bottom bar for the calendar page (#91)
- Loading branch information
Showing
4 changed files
with
174 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import React from 'react'; | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { Course, Status } from '@shared/types/Course'; | ||
import Instructor from '@shared/types/Instructor'; | ||
import { CalendarBottomBar } from '@views/components/common/CalendarBottomBar/CalendarBottomBar'; | ||
import { getCourseColors } from '../../shared/util/colors'; | ||
|
||
const exampleGovCourse: Course = new Course({ | ||
courseName: 'Nope', | ||
creditHours: 3, | ||
department: 'GOV', | ||
description: ['nah', 'aint typing this', 'corndog'], | ||
flags: ['no flag for you >:)'], | ||
fullName: 'GOV 312L Something something', | ||
instructionMode: 'Online', | ||
instructors: [ | ||
new Instructor({ | ||
firstName: 'Bevo', | ||
lastName: 'Barrymore', | ||
fullName: 'Bevo Barrymore', | ||
}), | ||
], | ||
isReserved: false, | ||
number: '312L', | ||
schedule: { | ||
meetings: [], | ||
}, | ||
semester: { | ||
code: '12345', | ||
season: 'Spring', | ||
year: 2024, | ||
}, | ||
status: Status.OPEN, | ||
uniqueId: 12345, | ||
url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/12345/', | ||
}); | ||
|
||
const examplePsyCourse: Course = new Course({ | ||
courseName: 'Nope Again', | ||
creditHours: 3, | ||
department: 'PSY', | ||
description: ['nah', 'aint typing this', 'corndog'], | ||
flags: ['no flag for you >:)'], | ||
fullName: 'PSY 317L Yada yada', | ||
instructionMode: 'Online', | ||
instructors: [ | ||
new Instructor({ | ||
firstName: 'Bevo', | ||
lastName: 'Etz', | ||
fullName: 'Bevo Etz', | ||
}), | ||
], | ||
isReserved: false, | ||
number: '317L', | ||
schedule: { | ||
meetings: [], | ||
}, | ||
semester: { | ||
code: '12346', | ||
season: 'Spring', | ||
year: 2024, | ||
}, | ||
status: Status.CLOSED, | ||
uniqueId: 12346, | ||
url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/12345/', | ||
}); | ||
|
||
const meta = { | ||
title: 'Components/Common/CalendarBottomBar', | ||
component: CalendarBottomBar, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
tags: ['autodocs'], | ||
argTypes: {}, | ||
} satisfies Meta<typeof CalendarBottomBar>; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
courses: [ | ||
{ | ||
colors: getCourseColors('pink', 200), | ||
courseDeptAndInstr: `${exampleGovCourse.department} ${exampleGovCourse.number} – ${exampleGovCourse.instructors[0].lastName}`, | ||
status: exampleGovCourse.status, | ||
}, | ||
{ | ||
colors: getCourseColors('slate', 500), | ||
courseDeptAndInstr: `${examplePsyCourse.department} ${examplePsyCourse.number} – ${examplePsyCourse.instructors[0].lastName}`, | ||
status: examplePsyCourse.status, | ||
}, | ||
], | ||
}, | ||
render: props => ( | ||
<div className='outline-red outline w-292.5!'> | ||
<CalendarBottomBar {...props} /> | ||
</div> | ||
), | ||
}; |
44 changes: 44 additions & 0 deletions
44
src/views/components/common/CalendarBottomBar/CalendarBottomBar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import clsx from 'clsx'; | ||
import Text from '../Text/Text'; | ||
import CalendarCourseBlock, { CalendarCourseCellProps } from '../CalendarCourseCell/CalendarCourseCell'; | ||
import { Button } from '../Button/Button'; | ||
import ImageIcon from '~icons/material-symbols/image'; | ||
import CalendarMonthIcon from '~icons/material-symbols/calendar-month'; | ||
|
||
type CalendarBottomBarProps = { | ||
courses: CalendarCourseCellProps[]; | ||
}; | ||
|
||
/** | ||
* | ||
*/ | ||
export const CalendarBottomBar = ({ courses }: CalendarBottomBarProps): JSX.Element => { | ||
if (courses.length === -1) console.log('foo'); // dumb line to make eslint happy | ||
return ( | ||
<div className='w-full flex py-1.25'> | ||
<div className='flex flex-grow items-center gap-3.75 pl-7.5 pr-2.5'> | ||
<Text variant='h4'>Async. and Other:</Text> | ||
<div className='h-14 inline-flex gap-2.5'> | ||
{courses.map(course => ( | ||
<CalendarCourseBlock | ||
courseDeptAndInstr={course.courseDeptAndInstr} | ||
status={course.status} | ||
colors={course.colors} | ||
key={course.courseDeptAndInstr} | ||
className={clsx(course.className, 'w-35!')} | ||
/> | ||
))} | ||
</div> | ||
</div> | ||
<div className='flex items-center pl-2.5 pr-7.5'> | ||
<Button variant='single' color='ut-black' icon={CalendarMonthIcon}> | ||
Save as .CAL | ||
</Button> | ||
<Button variant='single' color='ut-black' icon={ImageIcon}> | ||
Save as .PNG | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters