refactor: update DayIndicators component and tests for improved clarity and accuracy

- Revised comments in DayIndicators component and test files to better describe the functionality of colored segments and rounding behavior.
- Updated test descriptions to reflect changes in rendering logic for single and multiple segments.
- Adjusted class names in the component and tests to ensure correct application of rounded styles based on segment positions.
This commit is contained in:
2026-03-03 18:19:52 +03:00
parent 68a153e4a7
commit 8bf92bd4a1
2 changed files with 15 additions and 15 deletions

View File

@@ -1,9 +1,9 @@
/**
* Colored dots for calendar day: duty (green), unavailable (amber), vacation (blue), events (accent).
* Colored segments (pill bar) for calendar day: duty (green), unavailable (amber), vacation (blue), events (accent).
* Ported from webapp calendar day-indicator markup and markers.css.
*
* Rounding is position-based (first / last / only child), not by indicator type, so multiple
* segments form one "pill": only the left and right ends are rounded.
* Rounding is position-based (first / last segment), so one or multiple segments always form a pill:
* first segment gets left rounding, last segment gets right rounding (single segment gets both).
*/
import { cn } from "@/lib/utils";
@@ -17,7 +17,7 @@ export interface DayIndicatorsProps {
vacationCount: number;
/** Whether the day has external calendar events (e.g. holiday). */
hasEvents: boolean;
/** When true (e.g. today cell), use darker dots for contrast. */
/** When true (e.g. today cell), use darker segments for contrast. */
isToday?: boolean;
className?: string;
}
@@ -50,9 +50,8 @@ export function DayIndicators({
<div
className={cn(
"flex w-[65%] justify-center gap-0.5 mt-1.5",
"[&>:only-child]:h-1.5 [&>:only-child]:min-w-[6px] [&>:only-child]:max-w-[6px] [&>:only-child]:rounded-full",
"[&>:first-child:not(:only-child)]:rounded-l-[3px]",
"[&>:last-child:not(:only-child)]:rounded-r-[3px]",
"[&>:first-child]:rounded-l-[3px]",
"[&>:last-child]:rounded-r-[3px]",
className
)}
aria-hidden