feat: responsive day chips via CSS container queries
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.
This commit is contained in:
@@ -202,7 +202,7 @@
|
||||
onkeydown={handleStripKeydown}
|
||||
>
|
||||
{#each dayKeys as dk, i (dk)}
|
||||
<span bind:this={chipRefs[dk]}>
|
||||
<div class="chip-slot" bind:this={chipRefs[dk]}>
|
||||
<DayChip
|
||||
dayKey={dk}
|
||||
weekdayLabel={DAY_NAMES[i]}
|
||||
@@ -215,7 +215,7 @@
|
||||
isWorkday={currentSettings ? isWorkday(dk, currentSettings.workdays_mask) : i < 5}
|
||||
onclick={() => selectDay(dk)}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
@@ -264,6 +264,16 @@
|
||||
scroll-snap-type: x mandatory;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
padding-bottom: 0.25rem;
|
||||
/* let chips grow to fill available width */
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
/* Each slot is a flex child that stretches and provides the container
|
||||
query context via the .chip-wrap inside DayChip */
|
||||
.chip-slot {
|
||||
flex: 1;
|
||||
min-width: 2.8rem;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.summary { background: #fff; border: 1px solid #dee2e6; border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
|
||||
|
||||
Reference in New Issue
Block a user