From 83822c777c7d6f754c2fdf1441dbff13e355de66 Mon Sep 17 00:00:00 2001 From: Heath Daniel Date: Tue, 27 Apr 2021 21:50:54 -0400 Subject: [PATCH] Fix calendar layout and adjust spacing --- pages/[user]/[type].tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pages/[user]/[type].tsx b/pages/[user]/[type].tsx index 1b9392e7..f49ffd64 100644 --- a/pages/[user]/[type].tsx +++ b/pages/[user]/[type].tsx @@ -67,11 +67,21 @@ export default function Type(props) { days.push(i); } - const calendar = days.map((day) => + + // Create placeholder elements for empty days in first week + const weekdayOfFirst = dayjs().month(selectedMonth).date(1).day(); + const emptyDays = Array(weekdayOfFirst).fill(null).map((day, i) => ( +
+ {null} +
+ )); + + // Combine placeholder days with actual days + const calendar = [...emptyDays, ...days.map((day) => - ); + )]; // Handle date change useEffect(async () => { @@ -132,7 +142,7 @@ export default function Type(props) {
-
+
{props.user.avatar && Avatar}

{props.user.name}