improve quality of life ux

This commit is contained in:
JCEEE
2026-09-14 13:38:52 +01:00
parent da6a6e372c
commit 8bb120e8eb
3 changed files with 175 additions and 21 deletions
+58 -1
View File
@@ -17,7 +17,13 @@
active: string;
onchange: (v: string) => void;
};
weeknav?: { current: string; onPrev: () => void; onNext: () => void };
weeknav?: {
current: string;
onPrev: () => void;
onNext: () => void;
onCurrent?: () => void;
isCurrent?: boolean;
};
sort?: {
options: { label: string; value: string }[];
active: string;
@@ -35,6 +41,15 @@
{@render children?.()}
{#if weeknav?.onCurrent}
<button
class="now-btn header-now"
class:now-hidden={weeknav.isCurrent !== false}
onclick={weeknav.onCurrent}
tabindex={weeknav.isCurrent === false ? 0 : -1}
><span>← Back to this week</span></button>
{/if}
<div class="view-tools">
{#if tabs}
<div class="tab-bar">
@@ -142,6 +157,13 @@
justify-content: space-between;
gap: 0.5rem;
}
/* Back-to-this-week CTA: lives outside .view-tools on the header's top
row, pushed right. Always rendered (visibility-toggled) so the header
keeps its height when it appears/disappears. */
.header-now {
margin-left: auto;
align-self: flex-end;
}
.nav-btn {
padding: 0.2rem 0.5rem;
border: 1px solid #d1d5db;
@@ -154,6 +176,41 @@
.nav-btn:hover {
background: #f3f4f6;
}
.nav-btn.now-btn {
font-size: 0.8rem;
font-weight: 700;
white-space: nowrap;
}
/* Same pill CTA as the member hero. Always rendered (visibility-toggled)
so the ‹ › buttons never jump when it appears/disappears. */
.now-btn {
background: none;
border: none;
cursor: pointer;
padding: 0;
}
.now-btn span {
display: inline-block;
background: rgba(255, 255, 255, 0.92);
color: #4338ca;
border-radius: 999px;
padding: 0.35rem 0.9rem;
font-size: 0.8rem;
font-weight: 800;
white-space: nowrap;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.view-header.hero .now-btn span {
background: rgba(255, 255, 255, 0.92);
color: #4338ca;
}
.now-btn:hover span {
background: #fff;
}
.now-btn.now-hidden {
visibility: hidden;
pointer-events: none;
}
.nav-label {
font-size: 0.85rem;
color: #374151;