Shop: pick the length after pressing Book
The card shows "from" the lowest price and the range of lengths; the slider moves into the booking panel, above the date picker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
This commit is contained in:
parent
e1a8a54458
commit
6ab0b75ec3
1 changed files with 34 additions and 25 deletions
|
|
@ -321,31 +321,11 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="mt-auto pt-3">
|
<div class="mt-auto pt-3">
|
||||||
{#if isService && item.durations.length > 1 && ui}
|
{#if isService && item.durations.length > 1}
|
||||||
<!-- Several lengths: a slider steps through them and the price follows. -->
|
<!-- Several lengths: the length is picked (slider) after pressing Book. -->
|
||||||
<label class="block">
|
<div class="flex flex-wrap items-center gap-x-3 gap-y-1">
|
||||||
<span class="flex items-baseline justify-between gap-3">
|
<span class="text-lg font-semibold text-sage-dark">from {formatPrice(lowestPrice(item.durations) ?? item.price, currency)}</span>
|
||||||
<span class="text-sm font-medium text-charcoal">{formatDuration(duration!.minutes)}</span>
|
<span class="text-xs text-charcoal/60">{formatDuration(item.durations[0].minutes)} – {formatDuration(item.durations[item.durations.length - 1].minutes)}</span>
|
||||||
<span class="text-lg font-semibold text-sage-dark">{formatPrice(duration!.price, currency)}</span>
|
|
||||||
</span>
|
|
||||||
<input
|
|
||||||
type="range"
|
|
||||||
class="mt-2 w-full cursor-pointer accent-sage"
|
|
||||||
min="0"
|
|
||||||
max={item.durations.length - 1}
|
|
||||||
step="1"
|
|
||||||
value={ui.durationIndex}
|
|
||||||
aria-label="Length of {item.name}"
|
|
||||||
aria-valuetext="{formatDuration(duration!.minutes)}, {formatPrice(duration!.price, currency)}"
|
|
||||||
oninput={(e) => selectDuration(item.id, Number(e.currentTarget.value))}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
<div class="mt-1 flex justify-between text-xs text-charcoal/50" aria-hidden="true">
|
|
||||||
{#each item.durations as option, i (option.minutes)}
|
|
||||||
<button type="button" tabindex="-1" class="hover:text-charcoal {i === ui.durationIndex ? 'font-semibold text-charcoal' : ''}" onclick={() => selectDuration(item.id, i)}>
|
|
||||||
{formatDuration(option.minutes)}
|
|
||||||
</button>
|
|
||||||
{/each}
|
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="flex flex-wrap items-center gap-x-3 gap-y-1">
|
<div class="flex flex-wrap items-center gap-x-3 gap-y-1">
|
||||||
|
|
@ -425,6 +405,35 @@
|
||||||
{@const shown = shownRange(ui.monthOffset)}
|
{@const shown = shownRange(ui.monthOffset)}
|
||||||
{@const anyShown = availableKeys.some((key) => key >= shown.from && key <= shown.to)}
|
{@const anyShown = availableKeys.some((key) => key >= shown.from && key <= shown.to)}
|
||||||
<div class={isList ? 'mt-5 border-t border-charcoal/10 pt-5 sm:basis-full' : 'border-t border-charcoal/10 bg-warm p-4'}>
|
<div class={isList ? 'mt-5 border-t border-charcoal/10 pt-5 sm:basis-full' : 'border-t border-charcoal/10 bg-warm p-4'}>
|
||||||
|
{#if item.durations.length > 1}
|
||||||
|
<!-- Several lengths: a slider steps through them and the price follows. -->
|
||||||
|
<div class="mb-5">
|
||||||
|
<label class="block">
|
||||||
|
<span class="flex items-baseline justify-between gap-3">
|
||||||
|
<span class="text-sm font-medium text-charcoal">Length · {formatDuration(duration.minutes)}</span>
|
||||||
|
<span class="text-lg font-semibold text-sage-dark">{formatPrice(duration.price, currency)}</span>
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
type="range"
|
||||||
|
class="mt-2 w-full cursor-pointer accent-sage"
|
||||||
|
min="0"
|
||||||
|
max={item.durations.length - 1}
|
||||||
|
step="1"
|
||||||
|
value={ui.durationIndex}
|
||||||
|
aria-label="Length of {item.name}"
|
||||||
|
aria-valuetext="{formatDuration(duration.minutes)}, {formatPrice(duration.price, currency)}"
|
||||||
|
oninput={(e) => selectDuration(item.id, Number(e.currentTarget.value))}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<div class="mt-1 flex justify-between text-xs text-charcoal/50" aria-hidden="true">
|
||||||
|
{#each item.durations as option, i (option.minutes)}
|
||||||
|
<button type="button" tabindex="-1" class="hover:text-charcoal {i === ui.durationIndex ? 'font-semibold text-charcoal' : ''}" onclick={() => selectDuration(item.id, i)}>
|
||||||
|
{formatDuration(option.minutes)}
|
||||||
|
</button>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<div class="mb-3 flex items-center justify-between gap-2">
|
<div class="mb-3 flex items-center justify-between gap-2">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue