From 37b5101e44c31d66234956dc8d5f2ac86d5885c5 Mon Sep 17 00:00:00 2001 From: doprz <52579214+doprz@users.noreply.github.com> Date: Wed, 6 Mar 2024 13:48:12 -0600 Subject: [PATCH] chore: update default story --- .../components/CalendarGrid.stories.tsx | 28 ++++++++++------- .../common/CalendarGrid/CalendarGrid.tsx | 31 ++++++++++--------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/stories/components/CalendarGrid.stories.tsx b/src/stories/components/CalendarGrid.stories.tsx index db63e5b6..eeff8e0f 100644 --- a/src/stories/components/CalendarGrid.stories.tsx +++ b/src/stories/components/CalendarGrid.stories.tsx @@ -1,19 +1,25 @@ -// 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; - + tags: ['autodocs'], + argTypes: { + saturday: { control: 'text' }, + sunday: { control: 'text' }, + }, +} satisfies Meta; export default meta; + type Story = StoryObj; -export const Default: Story = {}; +export const Default: Story = { + args: { + saturday: true, + sunday: true, + }, +}; diff --git a/src/views/components/common/CalendarGrid/CalendarGrid.tsx b/src/views/components/common/CalendarGrid/CalendarGrid.tsx index 4dbd06c9..0bd85c10 100644 --- a/src/views/components/common/CalendarGrid/CalendarGrid.tsx +++ b/src/views/components/common/CalendarGrid/CalendarGrid.tsx @@ -5,7 +5,6 @@ import CalendarCell from '../CalendarGridCell/CalendarGridCell'; 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); const grid = []; @@ -24,15 +23,15 @@ for (let i = 0; i < 13; i++) { } interface Props { - courseCells: typeof CalendarCourseCell[]; + courseCells: any[]; + saturdayClass: boolean; } /** * Grid of CalendarGridCell components forming the user's course schedule calendar view * @param props */ -export function Calendar({ courseCells }: React.PropsWithChildren): JSX.Element { - +function CalendarGrid({ courseCells, saturdayClass }: React.PropsWithChildren ): JSX.Element { return (
@@ -56,20 +55,22 @@ export function Calendar({ courseCells }: React.PropsWithChildren): JSX.E {day}
))} - {grid.map((row) => row)} + {grid.map(row => row)}
- {courseCells.map((Block: typeof CalendarCourseCell) => ( -
- + {/* courseCells.map((Block: typeof CalendarCourseCell) => ( +
+
- ))} + )) */}
); -}; +} -export default Calendar; +export default CalendarGrid;