Checkout: theme cart and checkout to the v2 design

Restyles the boboko-core cart drawer, checkout and confirmation pages to
match the "cart - checkout v2" Pencil design (round radios, brand-green
selection, borders removed, larger notes and meta labels). strip-accents
now covers the module's uppercased buttons; vite.config.js comment fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
elviraandClaude Opus 5.5 committed 2026-11-03 21:26:28 +02:00
1 parent e4dccd0205
commit 4e4a02c4ed
3 files changed
+149 -57

No files matched your search

+138 -52
View File
@@ -45,11 +45,12 @@ .bbk-confirmation {
/* Primary CTA — x-ui.button "primary". The offset black block is a /* Primary CTA — x-ui.button "primary". The offset black block is a
box-shadow here rather than .btn-primary's ::before/::after, because the box-shadow here rather than .btn-primary's ::before/::after, because the
module's buttons have no inner <span> to lift the label above a module's buttons have no inner <span> to lift the label above a
positioned ::before. Same look, same easing. No `uppercase`: the module positioned ::before. Same look, same easing. Uppercased here because the
markup can't carry the class strip-accents.js needs for Greek. */ module markup can't carry the `uppercase` class; strip-accents.js lists
these selectors so Greek still loses its tonos. */
.bbk-cart-checkout, .bbk-cart-checkout,
.bbk-checkout-continue { .bbk-checkout-continue {
@apply border-black bg-neutral-200 px-6 py-3.5 text-base font-bold italic text-black; @apply border-black bg-neutral-200 px-6 py-3.5 text-base font-bold uppercase italic text-black;
box-shadow: 10px 10px 0 var(--color-black); box-shadow: 10px 10px 0 var(--color-black);
transition: box-shadow 0.35s cubic-bezier(0.2, 0.78, 0.12, 0.86); transition: box-shadow 0.35s cubic-bezier(0.2, 0.78, 0.12, 0.86);
} }
@@ -73,9 +74,10 @@ .bbk-checkout-continue:disabled {
@apply opacity-50; @apply opacity-50;
} }
/* Secondary button — x-ui.button "secondary", size sm */ /* Secondary button — x-ui.button "secondary", size sm. Uppercased like the
primary CTA (see strip-accents.js). */
.bbk-cart-coupon-submit { .bbk-cart-coupon-submit {
@apply border-black bg-transparent px-6 py-2 text-sm font-semibold transition-colors hover:bg-black hover:text-neutral-200; @apply border-black bg-transparent px-5 py-2 text-sm font-bold uppercase italic transition-colors hover:bg-black hover:text-neutral-200;
} }
/* Text inputs — x-ui.input: bottom border only, transparent */ /* Text inputs — x-ui.input: bottom border only, transparent */
@@ -138,10 +140,12 @@ .bbk-field-error {
@apply text-sm; @apply text-sm;
} }
/* x-ui.checkbox — square box, brand fill when ticked. Radios in the /* x-ui.checkbox — square box that fills brand green when ticked, with a
shipping/payment cards use the same box (square design, no circles). */ black check. Radios in the shipping/payment cards share its look but are
round with a round black dot: the one deliberate exception to the
project's no-border-radius rule, per the design. */
.bbk-checkbox { .bbk-checkbox {
@apply gap-3; @apply items-center gap-3;
font-size: inherit; font-size: inherit;
} }
@@ -149,17 +153,27 @@ .bbk-checkbox--stacked {
@apply mt-0 text-sm; @apply mt-0 text-sm;
} }
.bbk-checkbox--stacked input {
@apply mt-0;
}
.bbk-checkbox--stacked a, .bbk-checkbox--stacked a,
.bbk-checkout-withdrawal a, .bbk-checkout-withdrawal a,
.bbk-checkout-login-prompt a, .bbk-checkout-login-prompt a,
.bbk-checkout-note a { .bbk-checkout-note a {
@apply underline hover:no-underline; @apply text-black underline hover:no-underline;
} }
.bbk-checkbox input[type="checkbox"], .bbk-checkbox input[type="checkbox"],
.bbk-checkout-shipping-option input[type="radio"], .bbk-checkout-shipping-option input[type="radio"],
.bbk-checkout-payment-option input[type="radio"] { .bbk-checkout-payment-option input[type="radio"] {
@apply relative size-4 shrink-0 cursor-pointer appearance-none border border-current bg-transparent; @apply relative m-0 size-5 shrink-0 cursor-pointer appearance-none border-[1.5px] border-black bg-transparent;
}
.bbk-checkbox input[type="checkbox"]:checked,
.bbk-checkout-shipping-option input[type="radio"]:checked,
.bbk-checkout-payment-option input[type="radio"]:checked {
@apply border-brand bg-brand;
} }
.bbk-checkbox input[type="checkbox"]:checked::after, .bbk-checkbox input[type="checkbox"]:checked::after,
@@ -167,8 +181,26 @@ .bbk-checkout-shipping-option input[type="radio"]:checked::after,
.bbk-checkout-payment-option input[type="radio"]:checked::after { .bbk-checkout-payment-option input[type="radio"]:checked::after {
content: ""; content: "";
position: absolute; position: absolute;
inset: 2px; inset: 0;
background: var(--color-brand); margin: auto;
background: var(--color-black);
}
.bbk-checkbox input[type="checkbox"]:checked::after {
@apply size-3.5;
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.bbk-checkout-shipping-option input[type="radio"],
.bbk-checkout-payment-option input[type="radio"],
.bbk-checkout-shipping-option input[type="radio"]:checked::after,
.bbk-checkout-payment-option input[type="radio"]:checked::after {
@apply rounded-full;
}
.bbk-checkout-shipping-option input[type="radio"]:checked::after,
.bbk-checkout-payment-option input[type="radio"]:checked::after {
@apply size-2;
} }
.bbk-checkbox input[type="checkbox"]:focus-visible, .bbk-checkbox input[type="checkbox"]:focus-visible,
@@ -180,12 +212,8 @@ .bbk-checkout-payment-option input[type="radio"]:focus-visible {
/* ═══════════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════════
CART DRAWER CART DRAWER
═══════════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════════ */
.bbk-cart-panel {
@apply border-l border-black;
}
.bbk-cart-panel-header { .bbk-cart-panel-header {
@apply px-8 py-6; @apply border-b-0 px-8 py-6;
} }
.bbk-cart-heading { .bbk-cart-heading {
@@ -198,6 +226,19 @@ .bbk-cart-item-remove {
@apply text-black transition-opacity hover:bg-transparent hover:text-black hover:opacity-70; @apply text-black transition-opacity hover:bg-transparent hover:text-black hover:opacity-70;
} }
/* Bin sits centred on the title's row, no negative-margin hit-area trick */
.bbk-cart-item-head {
@apply items-center;
}
.bbk-cart-item-remove {
@apply m-0 size-7;
}
.bbk-cart-item-remove-icon {
@apply size-6;
}
.bbk-cart-panel-body { .bbk-cart-panel-body {
@apply p-8; @apply p-8;
} }
@@ -207,12 +248,7 @@ .bbk-cart-error {
} }
.bbk-cart-items { .bbk-cart-items {
@apply mb-8 gap-6; @apply mb-8 gap-8;
}
.bbk-cart-item-media img,
.bbk-confirmation-line .bbk-cart-item-media img {
@apply border border-black;
} }
.bbk-cart-item-title { .bbk-cart-item-title {
@@ -235,7 +271,7 @@ .bbk-cart-qty-btn {
} }
.bbk-cart-qty-input { .bbk-cart-qty-input {
@apply h-8 w-10 bg-transparent font-display font-bold; @apply h-8 w-10 border-x-0 bg-transparent font-display font-bold;
} }
.bbk-cart-qty-btn:focus-visible, .bbk-cart-qty-btn:focus-visible,
@@ -245,7 +281,7 @@ .bbk-cart-qty-input:focus-visible {
/* Summary */ /* Summary */
.bbk-cart-summary { .bbk-cart-summary {
@apply gap-3 pt-6; @apply gap-3 border-t-0 pt-6;
} }
.bbk-cart-coupon { .bbk-cart-coupon {
@@ -285,7 +321,7 @@ .bbk-checkout-page {
} }
.bbk-checkout-heading { .bbk-checkout-heading {
@apply mb-12 font-display text-h3 font-black tracking-tight sm:text-h2; @apply mb-12 font-display text-h3 leading-[1.25] font-extrabold lg:text-h2;
} }
.bbk-checkout { .bbk-checkout {
@@ -297,7 +333,7 @@ .bbk-checkout-main {
} }
.bbk-checkout-section { .bbk-checkout-section {
@apply gap-8 pb-10; @apply gap-8 border-b-0 pb-10;
} }
.bbk-checkout-section-heading, .bbk-checkout-section-heading,
@@ -305,13 +341,16 @@ .bbk-checkout-summary-heading {
@apply font-display text-h4 font-extrabold; @apply font-display text-h4 font-extrabold;
} }
.bbk-checkout-note,
.bbk-checkout-status, .bbk-checkout-status,
.bbk-checkout-withdrawal, .bbk-checkout-withdrawal,
.bbk-checkout-error { .bbk-checkout-error {
@apply text-sm; @apply text-sm;
} }
.bbk-checkout-note {
@apply text-base;
}
.bbk-checkout-login-prompt a { .bbk-checkout-login-prompt a {
@apply font-bold; @apply font-bold;
} }
@@ -321,22 +360,28 @@ .bbk-checkout-shipping-fields {
@apply gap-8; @apply gap-8;
} }
/* Shipping / payment choices — bordered cards that fill black when picked, /* Shipping / payment choices — white cards; the picked one gets a brand
like x-ui.option-buttons' pressed state. */ border. Every card carries the 2px border (transparent until picked) so
picking one doesn't shift the layout. */
.bbk-checkout-shipping-options,
.bbk-checkout-payment-options {
@apply gap-4;
}
.bbk-checkout-shipping-option, .bbk-checkout-shipping-option,
.bbk-checkout-payment-option, .bbk-checkout-payment-option,
.bbk-checkout-shipping-confirmed { .bbk-checkout-shipping-confirmed {
@apply gap-4 px-6 py-4; @apply gap-4 px-6 py-5;
} }
.bbk-checkout-shipping-option, .bbk-checkout-shipping-option,
.bbk-checkout-payment-option { .bbk-checkout-payment-option {
@apply transition-colors; @apply border-2 border-transparent bg-white transition-colors;
} }
.bbk-checkout-shipping-option:has(input:checked), .bbk-checkout-shipping-option:has(input:checked),
.bbk-checkout-payment-option:has(input:checked) { .bbk-checkout-payment-option:has(input:checked) {
@apply bg-black text-neutral-200; @apply border-brand;
} }
.bbk-checkout-shipping-option-name, .bbk-checkout-shipping-option-name,
@@ -348,10 +393,6 @@ .bbk-checkout-shipping-option-description {
@apply text-sm; @apply text-sm;
} }
.bbk-checkout-shipping-option:has(input:checked) .bbk-checkout-shipping-option-description {
@apply text-neutral-400;
}
.bbk-checkout-shipping-option-price { .bbk-checkout-shipping-option-price {
@apply font-display font-bold; @apply font-display font-bold;
} }
@@ -416,7 +457,7 @@ .bbk-checkout-aside {
} }
.bbk-checkout-summary { .bbk-checkout-summary {
@apply bg-transparent p-8; @apply border-0 bg-white p-6 lg:p-8;
} }
.bbk-checkout-summary-heading { .bbk-checkout-summary-heading {
@@ -437,26 +478,38 @@ .bbk-spinner {
} }
/* ═══════════════════════════════════════════════════════════════════ /* ═══════════════════════════════════════════════════════════════════
CONFIRMATION PAGE — same shape as account/orders/show CONFIRMATION PAGE
═══════════════════════════════════════════════════════════════════ */ ═══════════════════════════════════════════════════════════════════ */
.bbk-confirmation { .bbk-confirmation {
@apply max-w-4xl px-8 py-16 lg:px-16; @apply max-w-4xl px-8 py-16 lg:px-16;
} }
.bbk-confirmation-heading { .bbk-confirmation-heading {
@apply mb-12 font-display text-h3 font-black tracking-tight sm:text-h2; @apply mb-12 font-display text-h3 leading-[1.25] font-extrabold lg:text-h2;
}
/* "You'll get a confirmation email" — brand-green strip, black icon */
.bbk-notice--info {
--bbk-notice-color: var(--color-black);
@apply items-center gap-2.5 border-0 bg-brand px-4 py-3.5 text-black;
}
/* Body copy size and weight (the module sets notices to 14px) */
.bbk-notice-text {
@apply text-lg leading-[1.389] font-normal;
} }
.bbk-confirmation-meta { .bbk-confirmation-meta {
@apply mb-6 gap-3 border-y border-black py-6; @apply mt-6 mb-12 gap-3 py-6;
} }
.bbk-confirmation-meta-row { .bbk-confirmation-meta-row {
@apply items-baseline;
font-size: inherit; font-size: inherit;
} }
.bbk-confirmation-meta-row dt { .bbk-confirmation-meta-row dt {
@apply text-sm; @apply text-base;
} }
.bbk-confirmation-meta-row dd { .bbk-confirmation-meta-row dd {
@@ -467,38 +520,71 @@ .bbk-confirmation .bbk-checkout-note + .bbk-checkout-note {
@apply mt-2; @apply mt-2;
} }
.bbk-confirmation-body { .bbk-confirmation-section {
@apply my-12 gap-12; @apply mt-12 border-t-0;
}
.bbk-confirmation-section-heading,
.bbk-confirmation-bank-transfer-heading {
@apply font-display text-h4 font-extrabold;
}
/* Order summary — white card, like the checkout page's summary column */
.bbk-confirmation-section:has(.bbk-confirmation-lines) {
@apply bg-white p-6 lg:p-8;
}
.bbk-confirmation-section-heading {
@apply mb-5;
} }
.bbk-confirmation-lines { .bbk-confirmation-lines {
@apply gap-6; @apply mb-5 gap-5;
}
.bbk-confirmation-line .bbk-cart-item-media img {
@apply bg-white;
} }
.bbk-confirmation-line-name { .bbk-confirmation-line-name {
@apply font-bold; @apply mb-1 font-bold;
} }
/* "× 1" drops to its own muted line under the name */
.bbk-confirmation-line-qty { .bbk-confirmation-line-qty {
@apply font-normal; @apply block text-sm font-normal;
} }
.bbk-confirmation-line-total { .bbk-confirmation-line-total {
@apply font-display font-bold; @apply font-display font-bold;
} }
.bbk-confirmation-lines .bbk-cart-summary { .bbk-confirmation .bbk-cart-summary {
@apply mt-6; @apply pt-0;
} }
/* Addresses — two columns */
.bbk-confirmation-addresses { .bbk-confirmation-addresses {
@apply gap-8; @apply gap-12 pt-0;
} }
.bbk-confirmation-address-heading { .bbk-confirmation-address-heading {
@apply mb-3 font-display text-xl font-extrabold; @apply mb-3.5 font-display text-xl font-extrabold;
} }
.bbk-address-lines { .bbk-address-lines {
@apply text-base text-black; @apply gap-1 text-base text-black;
}
.bbk-address-lines > :first-child {
@apply font-bold;
}
/* Bank transfer instructions (admin-authored HTML) */
.bbk-confirmation-bank-transfer-heading {
@apply mb-2;
}
.bbk-confirmation-bank-transfer-body {
@apply text-base leading-6;
} }
+8 -3
View File
@@ -39,8 +39,13 @@ function processElement(el) {
} }
} }
// `.uppercase` plus the cart/checkout module's buttons, which the theme
// uppercases in resources/css/checkout.css (the module's markup can't carry
// the class).
const UPPERCASE_SELECTOR = '.uppercase, .bbk-cart-checkout, .bbk-checkout-continue, .bbk-cart-coupon-submit'
function applyToPage() { function applyToPage() {
document.querySelectorAll('.uppercase').forEach(processElement) document.querySelectorAll(UPPERCASE_SELECTOR).forEach(processElement)
} }
// ── Initial pass ────────────────────────────────────────────────────────────── // ── Initial pass ──────────────────────────────────────────────────────────────
@@ -51,8 +56,8 @@ const observer = new MutationObserver(mutations => {
for (const { addedNodes } of mutations) { for (const { addedNodes } of mutations) {
for (const node of addedNodes) { for (const node of addedNodes) {
if (node.nodeType !== Node.ELEMENT_NODE) continue if (node.nodeType !== Node.ELEMENT_NODE) continue
if (node.classList?.contains('uppercase')) processElement(node) if (node.matches?.(UPPERCASE_SELECTOR)) processElement(node)
node.querySelectorAll?.('.uppercase').forEach(processElement) node.querySelectorAll?.(UPPERCASE_SELECTOR).forEach(processElement)
} }
} }
}) })
+3 -2
View File
@@ -13,8 +13,9 @@ export default defineConfig({
laravel({ laravel({
input: [ input: [
// checkout.css first: it's the portable cart/checkout module's // checkout.css first: it's the portable cart/checkout module's
// structural base (@layer bbk-checkout) and must load before // base styles (plain, unlayered CSS) and must load before
// app.css so the host's own .bbk-* theming always wins. // app.css so the host's own unlayered .bbk-* theming wins on
// source order.
// Sourced from the @boboko/core npm package (a local // Sourced from the @boboko/core npm package (a local
// `file:../boboko-core` dependency — see package.json and // `file:../boboko-core` dependency — see package.json and
// boboko()'s own comments in @boboko/core/vite-plugin for why // boboko()'s own comments in @boboko/core/vite-plugin for why