make PDP variant selection work without JS
All checks were successful
deploy / deploy (push) Successful in 1m3s

Variant options (colour, size) are now URL params handled via
handle_params instead of phx-click events. Swatches and size buttons
render as patch links in shop mode, so changing variants works as
plain navigation without JS. Quantity is now a number input that
submits with the form. Unavailable variants render as disabled spans.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-25 01:08:36 +00:00
parent a61adf4939
commit 23e95a3de6
6 changed files with 238 additions and 75 deletions

View File

@@ -578,11 +578,18 @@
position: relative;
cursor: pointer;
padding: 0;
display: inline-block;
text-decoration: none;
&[aria-pressed="true"] {
border-color: var(--t-accent);
--tw-ring-color: var(--t-accent);
}
&[aria-disabled="true"] {
opacity: 0.3;
cursor: not-allowed;
}
}
.size-btn {
@@ -594,11 +601,18 @@
font-weight: 500;
transition: all 0.2s ease;
cursor: pointer;
text-decoration: none;
&[aria-pressed="true"] {
border-color: var(--t-accent);
background: color-mix(in oklch, var(--t-accent) 10%, transparent);
}
&[aria-disabled="true"] {
opacity: 0.3;
cursor: not-allowed;
border-style: dashed;
}
}
/* ── Quantity selector ── */
@@ -643,9 +657,20 @@
color: var(--t-text-primary);
padding: 0.5rem 1rem;
border-inline: 2px solid var(--t-border-default);
min-width: 3rem;
width: 3.5rem;
text-align: center;
font-variant-numeric: tabular-nums;
background: none;
border-top: none;
border-bottom: none;
font: inherit;
appearance: textfield;
&::-webkit-inner-spin-button,
&::-webkit-outer-spin-button {
appearance: none;
margin: 0;
}
}
.stock-in {