From 12f680d7e9aef826281c8f769825408dc6f9f9de Mon Sep 17 00:00:00 2001 From: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:57:22 -0600 Subject: [PATCH] feat: finish ScheduleTotalHoursAndCourses --- .../SchedulTotalHoursAndCourses.stories.tsx | 27 ++++++++ .../ScheduleTotalHoursAndCourses.tsx | 64 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 src/stories/components/SchedulTotalHoursAndCourses.stories.tsx create mode 100644 src/views/components/common/ScheduleTotalHoursAndCourses/ScheduleTotalHoursAndCourses.tsx diff --git a/src/stories/components/SchedulTotalHoursAndCourses.stories.tsx b/src/stories/components/SchedulTotalHoursAndCourses.stories.tsx new file mode 100644 index 000000000..7546c40dc --- /dev/null +++ b/src/stories/components/SchedulTotalHoursAndCourses.stories.tsx @@ -0,0 +1,27 @@ +import { Meta, StoryObj } from '@storybook/react'; +import ScheduleTotalHoursAndCourses from '@views/components/common/ScheduleTotalHoursAndCourses/ScheduleTotalHoursAndCourses'; + +const meta = { + title: 'Components/Common/ScheduleTotalHoursAndCourses', + component: ScheduleTotalHoursAndCourses, + parameters: { + layout: 'centered', + }, + tags: ['autodocs'], + argTypes: { + scheduleName: { control: 'text' }, + totalHours: { control: 'number' }, + totalCourses: { control: 'number' } + }, +} satisfies Meta; +export default meta; + +type Story = StoryObj; + +export const Default: Story = { + args: { + scheduleName: 'text', + totalHours: 22, + totalCourses: 8 + }, +}; \ No newline at end of file diff --git a/src/views/components/common/ScheduleTotalHoursAndCourses/ScheduleTotalHoursAndCourses.tsx b/src/views/components/common/ScheduleTotalHoursAndCourses/ScheduleTotalHoursAndCourses.tsx new file mode 100644 index 000000000..3e655e26c --- /dev/null +++ b/src/views/components/common/ScheduleTotalHoursAndCourses/ScheduleTotalHoursAndCourses.tsx @@ -0,0 +1,64 @@ +import clsx from 'clsx'; +import React, { useState } from 'react'; +import { Course, Status } from '@shared/types/Course'; +import { StatusIcon } from '@shared/util/icons'; +import { CourseColors, getCourseColors, pickFontColor } from '@shared/util/colors'; +import DragIndicatorIcon from '~icons/material-symbols/drag-indicator'; +import Text from '../Text/Text'; + +/** + * Props for ScheduleTotalHoursAndCourses + */ +export interface ScheduleTotalHoursAndCoursesProps { + scheduleName: string; + totalHours: number; + totalCourses: number; +} + +/** + * The ScheduleTotalHoursAndCourses as per the Labels and Details Figma section + * + * @param props ScheduleTotalHoursAndCoursesProps + */ +export default function ScheduleTotalHoursAndCoursess({ scheduleName, totalHours, totalCourses }: ScheduleTotalHoursAndCoursesProps): JSX.Element { + return ( +
+ + {`${scheduleName}: `} + + + {`${totalHours} HOURS`} + + + {`${totalCourses} courses`} + +
+ ); +}