fix: grid JSX.Element generation
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
.calendarGrid {
|
.calendarGrid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(5, 1fr);
|
grid-template-columns: repeat(6, 1fr);
|
||||||
grid-template-rows: repeat(13, 1fr);
|
grid-template-rows: repeat(13, 1fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,23 +5,13 @@ import { DAY_MAP } from 'src/shared/types/CourseMeeting';
|
|||||||
|
|
||||||
const daysOfWeek = Object.keys(DAY_MAP).filter(key => !['SAT', 'SUN'].includes(key));
|
const daysOfWeek = Object.keys(DAY_MAP).filter(key => !['SAT', 'SUN'].includes(key));
|
||||||
const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8);
|
const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8);
|
||||||
const grid = Array.from({ length: 6 }, (_, rowIndex) => {
|
const grid = [];
|
||||||
let index = 0;
|
for (let i = 0; i < 13; i++) {
|
||||||
return Array.from({ length: 13 }, (_, columnIndex) => {
|
const row = [];
|
||||||
if (columnIndex == 0) {
|
row.push(hoursOfDay[i]);
|
||||||
index += 1;
|
const row = Array.from({ length: 5 }, (_, j) => <CalendarCell key={j} />);
|
||||||
return (
|
grid.push(row);
|
||||||
<div key={columnIndex} className={styles.timeBlock}>
|
|
||||||
<div className={styles.timeLabelContainer}>
|
|
||||||
<p>{hoursOfDay[index - 1]}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return <CalendarCell key={columnIndex} />;
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grid of CalendarGridCell components forming the user's course schedule calendar view
|
* Grid of CalendarGridCell components forming the user's course schedule calendar view
|
||||||
|
|||||||
Reference in New Issue
Block a user