From bfeb2398aacf9a1fba892737b6ef0286acbc326f Mon Sep 17 00:00:00 2001
From: doprz <52579214+doprz@users.noreply.github.com>
Date: Wed, 6 Mar 2024 10:26:05 -0600
Subject: [PATCH] feat: calendar grid and grid cells (#81)
---
.../CalendarGrid/CalendarGrid.module.scss | 75 ++++++++++++++-----
.../common/CalendarGrid/CalendarGrid.tsx | 32 +++++---
.../CalendarGridCell.module.scss | 11 ++-
3 files changed, 82 insertions(+), 36 deletions(-)
diff --git a/src/views/components/common/CalendarGrid/CalendarGrid.module.scss b/src/views/components/common/CalendarGrid/CalendarGrid.module.scss
index 927ccb53..b17367ca 100644
--- a/src/views/components/common/CalendarGrid/CalendarGrid.module.scss
+++ b/src/views/components/common/CalendarGrid/CalendarGrid.module.scss
@@ -3,6 +3,7 @@
.dayLabelContainer {
display: flex;
+ flex-direction: row;
height: 13px;
min-width: 40px;
min-height: 13px;
@@ -13,24 +14,44 @@
flex: 1 0 0;
}
-.dayLabel {
+.calendarGrid {
+ display: grid;
+ grid-template-columns: repeat(5, 1fr);
+ grid-template-rows: repeat(13, 1fr);
+}
+
+.calendarRow {
+ display: flex;
+}
+
+.calendar {
+ // display: grid;
+ // grid-template-columns: auto repeat(5, 1fr);
+ gap: 10px;
+}
+
+.day {
+ gap: 5px;
color: colors.$burnt_orange;
text-align: center;
- font-family: Roboto;
font-size: 14.22px;
font-style: normal;
font-weight: 500;
line-height: normal;
}
-.calendar {
- display: grid;
- grid-template-columns: auto repeat(5, 1fr);
- gap: 10px;
+.timeAndGrid {
+ display: flex;
}
-.day {
- gap: 5px;
+.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);
}
.timeBlock {
@@ -41,18 +62,32 @@
max-width: 50px;
min-height: 40px;
flex-direction: column;
- justify-content: flex-end;
align-items: flex-end;
-}
-.timeLabelContainer {
- display: flex;
- max-height: 20px;
- flex-direction: column;
- justify-content: flex-end;
- align-items: flex-end;
- gap: 17px;
- flex: 1 0 0;
- align-self: stretch;
- border-radius: var(--border-radius-none, 0px);
+ .timeLabelContainer {
+ display: flex;
+ max-height: 20px;
+ flex-direction: column;
+ align-items: flex-end;
+ gap: 17px;
+ flex: 1 0 0;
+ align-self: stretch;
+ border-radius: var(--border-radius-none, 0px);
+ }
+
+ p {
+ color: #1a2024;
+ text-align: left;
+ height: 6.6px;
+ align-self: stretch;
+ margin-top: 0;
+ margin-bottom: 0;
+
+ /* Type scale/small */
+ font-family: 'Roboto Flex';
+ font-size: 14.22px;
+ font-style: normal;
+ font-weight: 500;
+ line-height: normal;
+ }
}
diff --git a/src/views/components/common/CalendarGrid/CalendarGrid.tsx b/src/views/components/common/CalendarGrid/CalendarGrid.tsx
index b3819998..ab60ff33 100644
--- a/src/views/components/common/CalendarGrid/CalendarGrid.tsx
+++ b/src/views/components/common/CalendarGrid/CalendarGrid.tsx
@@ -3,8 +3,11 @@ import styles from './CalendarGrid.module.scss';
import CalendarCell from '../CalendarGridCell/CalendarGridCell';
import { DAY_MAP } from 'src/shared/types/CourseMeeting';
-const daysOfWeek = Object.values(DAY_MAP);
+const daysOfWeek = Object.values(DAY_MAP).filter(d => d != 'Saturday' && d != 'Sunday');
const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8);
+const grid = Array.from({ length: 5 }, () =>
+ Array.from({ length: 13 }, (_, columnIndex) =>
+ {hour % 12 === 0 ? 12 : hour % 12}:00 {hour < 12 ? 'AM' : 'PM'} +