From 1b69b73eb9e98ba1effa00a702145a6c4bae8706 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 23 Jan 2024 23:15:54 +0800 Subject: [PATCH] chore: update calendar styles --- web/src/components/ActivityCalendar.tsx | 28 +++++++++++++------------ web/src/pages/Timeline.tsx | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/web/src/components/ActivityCalendar.tsx b/web/src/components/ActivityCalendar.tsx index 11d62e75..447c5dbf 100644 --- a/web/src/components/ActivityCalendar.tsx +++ b/web/src/components/ActivityCalendar.tsx @@ -9,20 +9,20 @@ interface Props { onClick?: (date: string) => void; } -const getBgColor = (count: number, maxCount: number) => { +const getCellAdditionalStyles = (count: number, maxCount: number) => { if (count === 0) { - return "bg-gray-100 dark:bg-gray-700"; + return "bg-gray-100 text-gray-400 dark:bg-gray-700 dark:text-gray-500"; } const ratio = count / maxCount; if (ratio > 0.7) { - return "bg-blue-600"; + return "bg-blue-600 text-gray-200"; } else if (ratio > 0.5) { - return "bg-blue-400"; + return "bg-blue-400 text-gray-200 dark:opacity-80"; } else if (ratio > 0.3) { - return "bg-blue-300"; + return "bg-blue-300 text-gray-200 dark:opacity-80"; } else { - return "bg-blue-200"; + return "bg-blue-200 text-gray-200 dark:opacity-80"; } }; @@ -47,7 +47,7 @@ const ActivityCalendar = (props: Props) => { } return ( -
+
{days.map((day, index) => { const date = getNormalizedDateString(`${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`); const count = data[date] || 0; @@ -57,19 +57,21 @@ const ActivityCalendar = (props: Props) => {
count && onClick && onClick(date)} - >
+ > + {day} +
) : (
); diff --git a/web/src/pages/Timeline.tsx b/web/src/pages/Timeline.tsx index fceb3102..5a961488 100644 --- a/web/src/pages/Timeline.tsx +++ b/web/src/pages/Timeline.tsx @@ -145,7 +145,7 @@ const Timeline = () => { {groupedByMonth.map((group, index) => (
-
+
{new Date(group.month).toLocaleString(i18n.language, { month: "short" })}