chore: add css class

This commit is contained in:
doprz
2024-03-06 13:11:36 -06:00
parent 07f75914bf
commit 9105bcba15
2 changed files with 29 additions and 22 deletions

View File

@@ -1,9 +1,15 @@
@use 'sass:color'; @use 'sass:color';
@use 'src/views/styles/colors.module.scss'; @use 'src/views/styles/colors.module.scss';
.dayLabelContainer { .calendar {
display: grid;
grid-template-columns: auto repeat(5, 1fr);
gap: 10px;
}
.day {
gap: 5px;
display: flex; display: flex;
flex-direction: row;
height: 13px; height: 13px;
min-width: 40px; min-width: 40px;
min-height: 13px; min-height: 13px;
@@ -12,9 +18,6 @@
align-items: center; align-items: center;
gap: 10px; gap: 10px;
flex: 1 0 0; flex: 1 0 0;
}
.dayLabel {
color: colors.$burnt_orange; color: colors.$burnt_orange;
text-align: center; text-align: center;
font-size: 14.22px; font-size: 14.22px;
@@ -23,14 +26,6 @@
line-height: normal; line-height: normal;
} }
.timeAndGrid {
display: flex;
}
.day {
gap: 5px;
}
.timeBlock { .timeBlock {
display: flex; display: flex;
width: 50px; width: 50px;

View File

@@ -4,6 +4,8 @@ import CalendarCell from '../CalendarGridCell/CalendarGridCell';
import { DAY_MAP } from 'src/shared/types/CourseMeeting'; import { DAY_MAP } from 'src/shared/types/CourseMeeting';
const daysOfWeek = Object.values(DAY_MAP); const daysOfWeek = Object.values(DAY_MAP);
daysOfWeek.pop();
daysOfWeek.pop();
const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8); const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8);
const grid = Array.from({ length: 5 }, () => const grid = Array.from({ length: 5 }, () =>
Array.from({ length: 13 }, (_, columnIndex) => <CalendarCell key={columnIndex} />) Array.from({ length: 13 }, (_, columnIndex) => <CalendarCell key={columnIndex} />)
@@ -16,17 +18,27 @@ const grid = Array.from({ length: 5 }, () =>
const Calendar: React.FC = (props) => { const Calendar: React.FC = (props) => {
return ( return (
<div className={styles.calendar}> <div className={styles.calendar}>
<div className={styles.dayLabelContainer}></div> <div className={styles.dayLabelContainer}>
{daysOfWeek.map((day, dayIndex) => ( {/* Empty cell in the top-left corner */}
<div key={dayIndex} className={styles.day}> <div className={styles.day} />
<div className={styles.dayLabelContainer}> {/* Displaying day labels */}
<div className={styles.dayLabel}>{day}</div> {daysOfWeek.map(day => (
<div key={day} className={styles.day}>
{day}
</div> </div>
{hoursOfDay.map((hour) => ( ))}
</div>
{/* Displaying the rest of the calendar */}
{hoursOfDay.map((hour) => (
<div key={hour} className={styles.row}>
{/* Hour column */}
<div className={styles.timeLabelContainer}>
<span>{hour}:00</span>
</div>
{/* Calendar cells for each day */}
{daysOfWeek.map((day, dayIndex) => (
<div key={`${day}-${hour}`} className={styles.timeBlock}> <div key={`${day}-${hour}`} className={styles.timeBlock}>
<div className={styles.timeLabelContainer}>
<span>{hour}:00</span>
</div>
<CalendarCell /> <CalendarCell />
</div> </div>
))} ))}