Skip to content

Commit

Permalink
feat: add Storybook story
Browse files Browse the repository at this point in the history
  • Loading branch information
doprz committed Mar 6, 2024
1 parent 4165d48 commit cb3cb5d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
16 changes: 8 additions & 8 deletions src/stories/components/CalendarGrid.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ 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'],
}
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 = {};
export const Default: Story = {};
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,8 @@
display: flex;
}

.timeColumn {
display: flex;
min-height: 573px;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
flex: 1 0 0;
border-radius: var(--border-radius-none, 0px);
.day {
gap: 5px;
}

.timeBlock {
Expand Down
8 changes: 6 additions & 2 deletions src/views/components/common/CalendarGrid/CalendarGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import styles from './CalendarGrid.module.scss';
import CalendarCell from '../CalendarGridCell/CalendarGridCell';
import { DAY_MAP } from 'src/shared/types/CourseMeeting';

const daysOfWeek = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'];
const daysOfWeek = Object.values(DAY_MAP);
const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8);
const grid = Array.from({ length: 5 }, () =>
Array.from({ length: 13 }, (_, columnIndex) => <CalendarCell key={columnIndex} />)
Expand All @@ -14,7 +15,10 @@ const grid = Array.from({ length: 5 }, () =>
*/
const Calendar: React.FC = props => {
return (
<div className={styles.calendar}>
<div className={styles.calendar}>
<div className={styles.dayLabelContainer}></div>
{daysOfWeek.map((day, dayIndex) => (
<div key={dayIndex} className={styles.day}>
<div className={styles.dayLabelContainer}>
{/* Empty cell in the top-left corner */}
<div className={styles.day} />
Expand Down

0 comments on commit cb3cb5d

Please sign in to comment.