Commit 96a91ebf authored by Johnny's avatar Johnny

chore: add week days to calendar

parent ea3371ba
...@@ -18,7 +18,7 @@ export const CompactMonthCalendar = memo((props: CompactMonthCalendarProps) => { ...@@ -18,7 +18,7 @@ export const CompactMonthCalendar = memo((props: CompactMonthCalendarProps) => {
const today = useTodayDate(); const today = useTodayDate();
const weekDays = useWeekdayLabels(); const weekDays = useWeekdayLabels();
const { weeks } = useCalendarMatrix({ const { weeks, weekDays: rotatedWeekDays } = useCalendarMatrix({
month, month,
data, data,
weekDays, weekDays,
...@@ -30,23 +30,33 @@ export const CompactMonthCalendar = memo((props: CompactMonthCalendarProps) => { ...@@ -30,23 +30,33 @@ export const CompactMonthCalendar = memo((props: CompactMonthCalendarProps) => {
const sizeConfig = size === "small" ? SMALL_CELL_SIZE : DEFAULT_CELL_SIZE; const sizeConfig = size === "small" ? SMALL_CELL_SIZE : DEFAULT_CELL_SIZE;
return ( return (
<div className={cn("grid grid-cols-7", sizeConfig.gap)}> <div className="flex flex-col gap-1">
{weeks.map((week, weekIndex) => <div className={cn("grid grid-cols-7 gap-0.5 text-muted-foreground", size === "small" ? "text-[10px]" : "text-xs")}>
week.days.map((day, dayIndex) => { {rotatedWeekDays.map((label, index) => (
const tooltipText = getTooltipText(day.count, day.date, t); <div key={index} className="flex h-4 items-center justify-center text-muted-foreground/50">
{label}
return ( </div>
<CalendarCell ))}
key={`${weekIndex}-${dayIndex}-${day.date}`} </div>
day={day}
maxCount={maxCount} <div className={cn("grid grid-cols-7", sizeConfig.gap)}>
tooltipText={tooltipText} {weeks.map((week, weekIndex) =>
onClick={onClick} week.days.map((day, dayIndex) => {
size={size} const tooltipText = getTooltipText(day.count, day.date, t);
/>
); return (
}), <CalendarCell
)} key={`${weekIndex}-${dayIndex}-${day.date}`}
day={day}
maxCount={maxCount}
tooltipText={tooltipText}
onClick={onClick}
size={size}
/>
);
}),
)}
</div>
</div> </div>
); );
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment