From f602e08b5a106b2720aacaf2a14d8a6c10f2c8b8 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 1 May 2026 13:29:07 +0200 Subject: [PATCH] feat: responsive day chips via CSS container queries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wrap each DayChip in a container-query context so the chip layout responds to the actual space available rather than the viewport width. Breakpoints (per-chip width): - < 72px (mobile, 7 chips in ~320px): compact — label + date + progress bar + badges only - ≥ 72px (tablet+): show worked duration text below the date number; slightly larger padding/font - ≥ 100px (desktop, 7 chips in ~750px wide main): larger date number, bigger worked label The .chip-slot div in week/+page.svelte is the flex child (flex: 1, min-width: 2.8rem) that feeds width into the container; .chip-wrap inside DayChip carries container-type: inline-size and fills the slot. --- web/src/lib/components/DayChip.svelte | 130 +++++++++++++++++++------- web/src/routes/week/+page.svelte | 14 ++- 2 files changed, 110 insertions(+), 34 deletions(-) diff --git a/web/src/lib/components/DayChip.svelte b/web/src/lib/components/DayChip.svelte index 0fe0c18..f1bed3d 100644 --- a/web/src/lib/components/DayChip.svelte +++ b/web/src/lib/components/DayChip.svelte @@ -32,6 +32,8 @@ // Progress bar fill: clamp to [0,1]. Non-workdays have expectedMs=0 → no bar. const progress = $derived(expectedMs > 0 ? Math.min(workedMs / expectedMs, 1) : 0); + const workedLabel = $derived(workedMs > 0 ? formatDurationShort(workedMs) : null); + // Kind icons (emoji-free: text labels used for kind badges) const KIND_ICON: Record = { holiday: 'H', @@ -40,39 +42,56 @@ }; - + +