Merge branch 'main' into ListComponentContinuation
This commit is contained in:
67
src/stories/components/CalendarCourseCell.stories.tsx
Normal file
67
src/stories/components/CalendarCourseCell.stories.tsx
Normal file
@@ -0,0 +1,67 @@
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
import React from 'react';
|
||||
import { Course, Status } from 'src/shared/types/Course';
|
||||
import { CourseMeeting, DAY_MAP } from 'src/shared/types/CourseMeeting';
|
||||
import { CourseSchedule } from 'src/shared/types/CourseSchedule';
|
||||
import Instructor from 'src/shared/types/Instructor';
|
||||
import CalendarCourseCell from 'src/views/components/common/CalendarCourseCell/CalendarCourseCell';
|
||||
|
||||
const meta = {
|
||||
title: 'Components/Common/CalendarCourseCell',
|
||||
component: CalendarCourseCell,
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
},
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
course: { control: 'object' },
|
||||
meetingIdx: { control: 'number' },
|
||||
color: { control: 'color' },
|
||||
},
|
||||
render: (args: any) => (
|
||||
<div className="w-45">
|
||||
<CalendarCourseCell {...args} />
|
||||
</div>
|
||||
),
|
||||
} satisfies Meta<typeof CalendarCourseCell>;
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
course: new Course({
|
||||
uniqueId: 123,
|
||||
number: '311C',
|
||||
fullName: "311C - Bevo's Default Course",
|
||||
courseName: "Bevo's Default Course",
|
||||
department: 'BVO',
|
||||
creditHours: 3,
|
||||
status: Status.WAITLISTED,
|
||||
instructors: [new Instructor({ firstName: '', lastName: 'Bevo', fullName: 'Bevo' })],
|
||||
isReserved: false,
|
||||
url: '',
|
||||
flags: [],
|
||||
schedule: new CourseSchedule({
|
||||
meetings: [
|
||||
new CourseMeeting({
|
||||
days: [DAY_MAP.M, DAY_MAP.W, DAY_MAP.F],
|
||||
startTime: 480,
|
||||
endTime: 570,
|
||||
location: {
|
||||
building: 'UTC',
|
||||
room: '123',
|
||||
},
|
||||
}),
|
||||
],
|
||||
}),
|
||||
instructionMode: 'In Person',
|
||||
semester: {
|
||||
year: 2024,
|
||||
season: 'Spring',
|
||||
},
|
||||
}),
|
||||
meetingIdx: 0,
|
||||
color: 'red',
|
||||
},
|
||||
};
|
||||
19
src/stories/components/CalendarGrid.stories.tsx
Normal file
19
src/stories/components/CalendarGrid.stories.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
// Calendar.stories.tsx
|
||||
import React from 'react';
|
||||
import Calendar from '@views/components/common/CalendarGrid/CalendarGrid';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
const meta = {
|
||||
title: 'Components/Common/Calendar',
|
||||
component: Calendar,
|
||||
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>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {};
|
||||
118
src/stories/components/PopupCourseBlock.stories.tsx
Normal file
118
src/stories/components/PopupCourseBlock.stories.tsx
Normal file
@@ -0,0 +1,118 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import React from 'react';
|
||||
import { Course, Status } from 'src/shared/types/Course';
|
||||
import { CourseMeeting } from 'src/shared/types/CourseMeeting';
|
||||
import Instructor from 'src/shared/types/Instructor';
|
||||
import PopupCourseBlock from '@views/components/common/PopupCourseBlock/PopupCourseBlock';
|
||||
import { getCourseColors } from 'src/shared/util/colors';
|
||||
import { theme } from 'unocss/preset-mini';
|
||||
|
||||
const exampleCourse: Course = new Course({
|
||||
courseName: 'ELEMS OF COMPTRS/PROGRAMMNG-WB',
|
||||
creditHours: 3,
|
||||
department: 'C S',
|
||||
description: [
|
||||
'Problem solving and fundamental algorithms for various applications in science, business, and on the World Wide Web, and introductory programming in a modern object-oriented programming language.',
|
||||
'Only one of the following may be counted: Computer Science 303E, 312, 312H. Credit for Computer Science 303E may not be earned after a student has received credit for Computer Science 314, or 314H. May not be counted toward a degree in computer science.',
|
||||
'May be counted toward the Quantitative Reasoning flag requirement.',
|
||||
'Designed to accommodate 100 or more students.',
|
||||
'Taught as a Web-based course.',
|
||||
],
|
||||
flags: ['Quantitative Reasoning'],
|
||||
fullName: 'C S 303E ELEMS OF COMPTRS/PROGRAMMNG-WB',
|
||||
instructionMode: 'Online',
|
||||
instructors: [
|
||||
new Instructor({
|
||||
firstName: 'Bevo',
|
||||
lastName: 'Bevo',
|
||||
fullName: 'Bevo Bevo',
|
||||
}),
|
||||
],
|
||||
isReserved: false,
|
||||
number: '303E',
|
||||
schedule: {
|
||||
meetings: [
|
||||
new CourseMeeting({
|
||||
days: ['Tuesday', 'Thursday'],
|
||||
endTime: 660,
|
||||
startTime: 570,
|
||||
}),
|
||||
],
|
||||
},
|
||||
semester: {
|
||||
code: '12345',
|
||||
season: 'Spring',
|
||||
year: 2024,
|
||||
},
|
||||
status: Status.WAITLISTED,
|
||||
uniqueId: 12345,
|
||||
url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20242/12345/',
|
||||
});
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
||||
const meta = {
|
||||
title: 'Components/Common/PopupCourseBlock',
|
||||
component: PopupCourseBlock,
|
||||
parameters: {
|
||||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
||||
layout: 'centered',
|
||||
},
|
||||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
||||
tags: ['autodocs'],
|
||||
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
||||
args: {
|
||||
colors: getCourseColors('emerald'),
|
||||
course: exampleCourse,
|
||||
},
|
||||
argTypes: {
|
||||
colors: {
|
||||
description: 'the colors to use for the course block',
|
||||
control: 'object',
|
||||
},
|
||||
course: {
|
||||
description: 'the course to show data for',
|
||||
control: 'object',
|
||||
},
|
||||
},
|
||||
} satisfies Meta<typeof PopupCourseBlock>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
||||
export const Default: Story = {
|
||||
args: {},
|
||||
};
|
||||
|
||||
export const Variants: Story = {
|
||||
render: props => (
|
||||
<div className='grid grid-cols-2 max-w-2xl w-90vw gap-x-4 gap-y-2'>
|
||||
<PopupCourseBlock {...props} course={new Course({ ...exampleCourse, status: Status.OPEN })} />
|
||||
<PopupCourseBlock {...props} course={new Course({ ...exampleCourse, status: Status.CLOSED })} />
|
||||
<PopupCourseBlock {...props} course={new Course({ ...exampleCourse, status: Status.WAITLISTED })} />
|
||||
<PopupCourseBlock {...props} course={new Course({ ...exampleCourse, status: Status.CANCELLED })} />
|
||||
</div>
|
||||
),
|
||||
};
|
||||
|
||||
const colors = Object.keys(theme.colors)
|
||||
// check that the color is a colorway (is an object)
|
||||
.filter(color => typeof theme.colors[color] === 'object')
|
||||
.slice(0, 17)
|
||||
.map(color => getCourseColors(color as keyof typeof theme.colors));
|
||||
|
||||
export const AllColors: Story = {
|
||||
render: props => (
|
||||
<div className='grid grid-rows-9 grid-cols-2 grid-flow-col max-w-2xl w-90vw gap-x-4 gap-y-2'>
|
||||
{colors.map((color, i) => (
|
||||
<PopupCourseBlock key={color.primaryColor} course={exampleCourse} colors={color} />
|
||||
))}
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
design: {
|
||||
type: 'figma',
|
||||
url: 'https://www.figma.com/file/8tsCay2FRqctrdcZ3r9Ahw/UTRP?type=design&node-id=1046-6714&mode=design&t=5Bjr7qGHNXmjfMTc-0',
|
||||
},
|
||||
},
|
||||
};
|
||||
57
src/stories/components/Text.stories.tsx
Normal file
57
src/stories/components/Text.stories.tsx
Normal file
@@ -0,0 +1,57 @@
|
||||
import { Button } from 'src/views/components/common/Button/Button';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import React from 'react';
|
||||
import Text from '../../views/components/common/Text/Text';
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
||||
const meta = {
|
||||
title: 'Components/Common/Text',
|
||||
component: Text,
|
||||
parameters: {
|
||||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
||||
layout: 'centered',
|
||||
},
|
||||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
||||
tags: ['autodocs'],
|
||||
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
||||
args: {
|
||||
children: 'The quick brown fox jumps over the lazy dog.',
|
||||
},
|
||||
argTypes: {
|
||||
children: { control: 'text' },
|
||||
},
|
||||
} satisfies Meta<typeof Text>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
||||
export const Default: Story = {
|
||||
args: {},
|
||||
};
|
||||
|
||||
export const AllVariants: Story = {
|
||||
args: {
|
||||
children: 'The quick brown fox jumps over the lazy dog.',
|
||||
},
|
||||
render: props => (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
||||
<Text {...props} variant='mini' />
|
||||
<Text {...props} variant='small' />
|
||||
<Text {...props} variant='p' />
|
||||
<Text {...props} variant='h4' />
|
||||
<Text {...props} variant='h3-course' />
|
||||
<Text {...props} variant='h3' />
|
||||
<Text {...props} variant='h2-course' />
|
||||
<Text {...props} variant='h2' />
|
||||
<Text {...props} variant='h1-course' />
|
||||
<Text {...props} variant='h1' />
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
design: {
|
||||
type: 'figma',
|
||||
url: 'https://www.figma.com/file/8tsCay2FRqctrdcZ3r9Ahw/UTRP?type=design&node-id=324-389&mode=design&t=BoS5xBrpSsjgQXqv-4',
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user