Compare commits

..

No commits in common. "a3dca4ebf5f6d7e4dd8b3b8e0fd1fa24ef720af7" and "0b5cddb655e23e56f33c01e69f2bf437ea74552e" have entirely different histories.

3 changed files with 52 additions and 83 deletions

View file

@ -394,8 +394,7 @@
<ul class="{holdLeftMs !== null && slotLineCount ? 'mt-4' : 'mt-8'} space-y-4">
{#each basket.lines as line (line.id)}
{@const pending = pendingLines.has(line.id)}
<!-- On a phone the quantity, price and remove button go on a row of their own under the description. -->
<li class="flex flex-wrap items-center gap-x-4 gap-y-3 rounded-2xl border border-charcoal/10 bg-white p-4 shadow-sm">
<li class="flex items-center gap-4 rounded-2xl border border-charcoal/10 bg-white p-4 shadow-sm">
{#if line.itemImageUrl}
<img
src={line.itemImageUrl}
@ -409,7 +408,7 @@
{/if}
<div class="min-w-0 flex-1">
<p class="break-words font-medium">{line.itemName ?? 'Item'}</p>
<p class="truncate font-medium">{line.itemName ?? 'Item'}</p>
{#if line.lineType === 'slot' && line.start}
<p class="text-sm text-fg-body/70">{formatSlotTime(line.start)}{line.minutes ? ` · ${formatDuration(line.minutes)}` : ''}</p>
{/if}
@ -454,7 +453,6 @@
{/if}
</div>
<div class="flex w-full items-center gap-3 sm:w-auto">
<!-- Products, and places in a group session (capacity > 1); the server checks what's left. -->
{#if line.lineType === 'item' || (line.slotCapacity ?? 1) > 1}
<div class="flex items-center gap-2">
@ -480,7 +478,7 @@
</div>
{/if}
<p class="ml-auto shrink-0 whitespace-nowrap text-right font-medium sm:min-w-20">
<p class="w-20 shrink-0 text-right font-medium">
{formatPrice((line.itemPrice ?? 0) * line.quantity, currency)}
</p>
@ -493,7 +491,6 @@
>
✕
</button>
</div>
</li>
{/each}
</ul>

View file

@ -6,9 +6,8 @@
let items = $derived(data.items?.length ? data.items : [
{ title: 'Your story here', description: 'Add milestones, training, or the journey behind the practice.' }
]);
// Desktop only: cards alternate sides and overlap a little; on a phone they stack in one column.
let widths = $derived(items.map((_: TimelineItem, i: number) => {
const opts = ['md:w-[78%]', 'md:w-[85%]', 'md:w-[90%]', 'md:w-[95%]', 'md:w-[98%]'];
const opts = ['w-[78%]', 'w-[85%]', 'w-[90%]', 'w-[95%]', 'w-[98%]'];
return opts[(i * 7 + 3) % opts.length];
}));
</script>
@ -20,9 +19,9 @@
</div>
<div class="relative md:before:absolute md:before:left-1/2 md:before:top-0 md:before:h-full md:before:w-px md:before:bg-sage/30">
{#each items as item, index}
<div use:scrollReveal class="reveal relative mb-4 grid gap-4 md:mb-[-1rem] md:grid-cols-2 md:gap-8">
<div use:scrollReveal class="reveal relative mb-[-1rem] grid gap-4 md:grid-cols-2 md:gap-8">
<div class="hidden md:block" class:md:order-2={index % 2 === 0}></div>
<article class="rounded-2xl bg-white/75 p-5 shadow-sm ring-1 ring-charcoal/5 md:-mt-4 {widths[index]} {index % 2 === 0 ? 'md:ml-auto md:text-right' : ''}">
<article class="rounded-2xl bg-white/75 p-5 shadow-sm ring-1 ring-charcoal/5 -mt-4 {widths[index]} {index % 2 === 0 ? 'md:ml-auto md:text-right' : ''}">
<h3 class="text-xl">{item.title}</h3>
<p class="mt-2 text-sm leading-6 text-fg-body/70">{item.description}</p>
</article>

View file

@ -4,7 +4,6 @@
dateKey,
eventMatchesCategories,
eventOverlapsDay,
eventOverlapsRange,
eventRange,
formatEventDateRange,
getCurrentAndNextMonths,
@ -27,12 +26,6 @@
return visibleEvents.filter((event) => eventOverlapsDay(event, date));
}
// On a phone the grid only shows coloured bars; this list under it says what they are.
function eventsInMonth(days: { date: Date; inMonth: boolean }[]) {
const inMonth = days.filter((day) => day.inMonth);
return visibleEvents.filter((event) => eventOverlapsRange(event, inMonth[0].date, inMonth[inMonth.length - 1].date));
}
function eventStyle(event: CalendarEventRecord) {
return `--event-color: ${event.color || '#8a9a7b'};`;
}
@ -49,11 +42,10 @@
return {
showLabel: visualStart,
classes: [
// Continuing bars reach across the cell padding and the gap (p-1/p-2 + gap-1).
visualStart ? 'rounded-l-xl' : 'rounded-l-none -ml-2 sm:-ml-3',
visualEnd ? 'rounded-r-xl' : 'rounded-r-none -mr-2 sm:-mr-3',
visualStart ? 'rounded-l-xl' : 'rounded-l-none -ml-3',
visualEnd ? 'rounded-r-xl' : 'rounded-r-none -mr-3',
visualStart && visualEnd ? 'mx-0' : '',
!visualStart && !visualEnd ? '-mx-2 sm:-mx-3' : ''
!visualStart && !visualEnd ? '-mx-3' : ''
].filter(Boolean).join(' ')
};
}
@ -71,14 +63,14 @@
{:else}
<div class="isolate grid gap-8 lg:grid-cols-2">
{#each months as month}
<div class="relative z-0 overflow-visible rounded-[2rem] border border-sage/15 bg-white/80 p-3 shadow-sm sm:p-5 backdrop-blur hover:z-[9000] focus-within:z-[9000]">
<div class="relative z-0 overflow-visible rounded-[2rem] border border-sage/15 bg-white/80 p-5 shadow-sm backdrop-blur hover:z-[9000] focus-within:z-[9000]">
<h3 class="font-display mb-5 text-center text-3xl text-charcoal">{month.label}</h3>
<div class="mb-2 grid grid-cols-7 gap-1 text-center text-xs font-semibold uppercase tracking-wide text-charcoal/45">
{#each weekdays as weekday}<div>{weekday}</div>{/each}
</div>
<div class="grid grid-cols-7 gap-1 overflow-visible">
{#each month.days as day}
<div class="relative min-h-14 overflow-visible rounded-xl border p-1 sm:min-h-28 sm:rounded-2xl sm:p-2 {day.inMonth ? 'border-sage/10 bg-warm/60' : 'border-sage/5 bg-warm/25'}" class:ring-2={day.isToday} class:ring-sage={day.isToday}>
<div class="relative min-h-28 overflow-visible rounded-2xl border p-2 {day.inMonth ? 'border-sage/10 bg-warm/60' : 'border-sage/5 bg-warm/25'}" class:ring-2={day.isToday} class:ring-sage={day.isToday}>
<div class="mb-1 flex items-center justify-between">
<span class="text-sm font-semibold {day.inMonth ? 'text-charcoal/70' : 'text-charcoal/30'}">{day.dayNumber}</span>
</div>
@ -89,7 +81,7 @@
{@const segment = segmentMeta(event, day.date)}
{#if href}
<a
class="group/event relative z-10 block h-2 px-2 text-left text-[0.7rem] sm:h-auto sm:py-1 font-semibold leading-tight text-white shadow-sm hover:z-[9999] hover:shadow-md focus:z-[9999] focus:outline-none focus:ring-2 focus:ring-charcoal/30 {segment.classes}"
class="group/event relative z-10 block px-2 py-1 text-left text-[0.7rem] font-semibold leading-tight text-white shadow-sm hover:z-[9999] hover:shadow-md focus:z-[9999] focus:outline-none focus:ring-2 focus:ring-charcoal/30 {segment.classes}"
href={href}
target={isExternalLink(href) ? '_blank' : undefined}
rel={isExternalLink(href) ? 'noreferrer' : undefined}
@ -97,8 +89,8 @@
aria-label={label}
>
<span class="absolute inset-0 bg-[var(--event-color)] {segment.classes}"></span>
<span class="relative hidden truncate sm:block">{segment.showLabel ? event.name : '\u00a0'}</span>
<span class="pointer-events-none absolute bottom-full z-[10000] mb-2 hidden w-64 rounded-xl bg-charcoal p-3 text-xs font-normal leading-relaxed text-white shadow-xl sm:group-hover/event:block sm:group-focus/event:block {day.date.getDay() >= 4 ? 'right-0' : 'left-0'}">
<span class="relative block truncate">{segment.showLabel ? event.name : '\u00a0'}</span>
<span class="pointer-events-none absolute bottom-full left-0 z-[10000] mb-2 hidden w-64 rounded-xl bg-charcoal p-3 text-xs font-normal leading-relaxed text-white shadow-xl group-hover/event:block group-focus/event:block">
<strong class="block">{event.name}</strong>
<span class="block opacity-80">{formatEventDateRange(event)}</span>
{#if event.description}<span class="mt-1 block">{event.description}</span>{/if}
@ -106,15 +98,15 @@
</a>
{:else}
<span
class="group/event relative z-10 block h-2 px-2 text-left text-[0.7rem] sm:h-auto sm:py-1 font-semibold leading-tight text-white shadow-sm hover:z-[9999] focus:z-[9999] focus:outline-none focus:ring-2 focus:ring-charcoal/30 {segment.classes}"
class="group/event relative z-10 block px-2 py-1 text-left text-[0.7rem] font-semibold leading-tight text-white shadow-sm hover:z-[9999] focus:z-[9999] focus:outline-none focus:ring-2 focus:ring-charcoal/30 {segment.classes}"
style={eventStyle(event)}
tabindex="0"
role="button"
aria-label={label}
>
<span class="absolute inset-0 bg-[var(--event-color)] {segment.classes}"></span>
<span class="relative hidden truncate sm:block">{segment.showLabel ? event.name : '\u00a0'}</span>
<span class="pointer-events-none absolute bottom-full z-[10000] mb-2 hidden w-64 rounded-xl bg-charcoal p-3 text-xs font-normal leading-relaxed text-white shadow-xl sm:group-hover/event:block sm:group-focus/event:block {day.date.getDay() >= 4 ? 'right-0' : 'left-0'}">
<span class="relative block truncate">{segment.showLabel ? event.name : '\u00a0'}</span>
<span class="pointer-events-none absolute bottom-full left-0 z-[10000] mb-2 hidden w-64 rounded-xl bg-charcoal p-3 text-xs font-normal leading-relaxed text-white shadow-xl group-hover/event:block group-focus/event:block">
<strong class="block">{event.name}</strong>
<span class="block opacity-80">{formatEventDateRange(event)}</span>
{#if event.description}<span class="mt-1 block">{event.description}</span>{/if}
@ -126,25 +118,6 @@
</div>
{/each}
</div>
{#if eventsInMonth(month.days).length}
<ul class="mt-4 space-y-3 sm:hidden">
{#each eventsInMonth(month.days) as event}
{@const href = normalizeLink(event.link)}
<li class="flex gap-3 text-sm" style={eventStyle(event)}>
<span class="mt-1 h-3 w-3 shrink-0 rounded-full bg-[var(--event-color)]" aria-hidden="true"></span>
<div class="min-w-0">
{#if href}
<a class="font-semibold text-charcoal underline underline-offset-2" {href} target={isExternalLink(href) ? '_blank' : undefined} rel={isExternalLink(href) ? 'noreferrer' : undefined}>{event.name}</a>
{:else}
<span class="font-semibold text-charcoal">{event.name}</span>
{/if}
<span class="text-charcoal/60"> · {formatEventDateRange(event)}</span>
{#if event.description}<p class="break-words text-charcoal/70">{event.description}</p>{/if}
</div>
</li>
{/each}
</ul>
{/if}
</div>
{/each}
</div>