Product page
Large picture with thumbnail switcher, bold title and price, a hairline spec table, an outlined quantity stepper and the filled red add-to-cart button that counts up.
Part of the style
Red Pen Shop
6 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/red-pen-shop/product/figma.html?palette=d2e0f716c6febc19
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/red-pen-shop/product/figma.html?palette=d2e0f716c6febc19 and pass that whole HTML document to the html_to_figma tool, so the part "Product page" lands as editable layers in my open Figma file. Fonts come from Google Fonts: if a face is missing in Figma, pick the closest one.
Code
<style>
/* Goes after the pack's base.css */
:root {
--red: #1d0c0b;
--paper: #f15b29;
--ground: #d15831;
--ground-shade: #b04b2c;
--cover-cream: #d65126;
--cover-navy: #480402;
--cover-cobalt: #200100;
--cover-pink: #682222;
--cover-mustard: #4b1c1c;
--peg: #472f2e;
--cover-lemon: #a66765;
--peg-hole: #070000;
--cover-leaf: #2f1312;
--cover-neon: #a2625f;
}
</style>
<section class="product">
<div class="product__body">
<div class="product__gallery">
<div class="product__stage">
<svg class="product__view is-active" viewBox="0 0 400 400" role="img" aria-label="Front cover: mustard with a steaming bowl">
<rect class="product__ground" width="400" height="400" />
<ellipse class="product__shadow" cx="206" cy="348" rx="110" ry="11" />
<rect class="product__fill-mustard" x="116" y="58" width="172" height="284" />
<rect class="product__spine-shade" x="116" y="58" width="10" height="284" />
<text class="product__cover-type" x="146" y="118">SOUP</text>
<text class="product__cover-type" x="146" y="150">FOR WET</text>
<text class="product__cover-type" x="146" y="182">WEEKS</text>
<path class="product__line" d="M164 262 C164 292 240 292 240 262 Z M156 262 h92 M188 250 c-5 -10 5 -14 0 -24 M210 250 c-5 -10 5 -14 0 -24" />
<text class="product__cover-small" x="146" y="322">Ida Marlow</text>
</svg>
<svg class="product__view" viewBox="0 0 400 400" role="img" aria-label="Back cover: blurb and barcode">
<rect class="product__ground" width="400" height="400" />
<ellipse class="product__shadow" cx="206" cy="348" rx="110" ry="11" />
<rect class="product__fill-mustard" x="116" y="58" width="172" height="284" />
<rect class="product__spine-shade" x="278" y="58" width="10" height="284" />
<path class="product__text-lines" d="M140 96 h124 M140 110 h124 M140 124 h110 M140 138 h124 M140 152 h80 M140 178 h124 M140 192 h96" />
<rect class="product__fill-paper" x="140" y="276" width="70" height="44" />
<path class="product__barcode" d="M146 282 v26 M150 282 v26 M155 282 v26 M158 282 v26 M163 282 v26 M168 282 v26 M171 282 v26 M176 282 v26 M181 282 v26 M184 282 v26 M189 282 v26 M194 282 v26 M198 282 v26 M203 282 v26" />
</svg>
<svg class="product__view" viewBox="0 0 400 400" role="img" aria-label="Open spread: a recipe beside a drawing of a pot">
<rect class="product__ground" width="400" height="400" />
<ellipse class="product__shadow" cx="200" cy="312" rx="168" ry="12" />
<path class="product__fill-cream" d="M200 104 C170 92 90 90 40 100 L40 300 C90 290 170 292 200 304 Z" />
<path class="product__fill-cream" d="M200 104 C230 92 310 90 360 100 L360 300 C310 290 230 292 200 304 Z" />
<path class="product__gutter" d="M200 104 V304" />
<text class="product__cover-small" x="62" y="134">Leek and barley, Tuesday</text>
<path class="product__text-lines" d="M62 156 h112 M62 170 h112 M62 184 h96 M62 206 h112 M62 220 h112 M62 234 h70 M62 256 h112 M62 270 h88" />
<circle class="product__fill-mustard" cx="280" cy="200" r="54" />
<path class="product__line" d="M244 206 C244 244 316 244 316 206 Z M236 206 h88 M268 194 c-5 -10 5 -14 0 -24 M290 194 c-5 -10 5 -14 0 -24" />
</svg>
</div>
<div class="product__thumbs" role="group" aria-label="Pictures">
<button class="product__thumb product__thumb--front is-active" type="button" aria-pressed="true" aria-label="Front cover"></button>
<button class="product__thumb product__thumb--back" type="button" aria-pressed="false" aria-label="Back cover"></button>
<button class="product__thumb product__thumb--spread" type="button" aria-pressed="false" aria-label="Open spread"></button>
</div>
</div>
<div class="product__info">
<p class="product__label">Books / Cookery</p>
<h2 class="product__title">Soup for Wet Weeks / Ida Marlow</h2>
<p class="product__price">€32.00 <span class="product__tax">tax included</span></p>
<p class="product__copy">Fifty-two soups, one for every week of a rainy year, written by a cook who keeps a pot on all winter. Stitched binding that lies flat beside the stove, two colours throughout.</p>
<dl class="product__specs">
<div class="product__spec"><dt>Publisher</dt><dd>Low Tide Press</dd></div>
<div class="product__spec"><dt>Year</dt><dd>2027</dd></div>
<div class="product__spec"><dt>Pages</dt><dd>192, stitched</dd></div>
<div class="product__spec"><dt>Size</dt><dd>170 × 240 mm</dd></div>
<div class="product__spec"><dt>Language</dt><dd>English</dd></div>
</dl>
<div class="product__buy">
<div class="product__stepper" role="group" aria-label="Quantity">
<button class="product__step" type="button" data-step="-1" aria-label="One less">−</button>
<output class="product__qty" aria-live="polite">1</output>
<button class="product__step" type="button" data-step="1" aria-label="One more">+</button>
</div>
<button class="product__add" type="button">Add to cart</button>
</div>
<p class="product__status" aria-live="polite">In your cart: <span class="product__count">0</span></p>
<p class="product__note">*Wrapped for free. Ships in 3 to 5 days.</p>
</div>
</div>
</section>
<style>
.product {
padding: 0 var(--gutter) 0 var(--inset);
background: var(--paper);
color: var(--red);
}
.product__body {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
column-gap: var(--gap);
padding-block: var(--space-xl);
border-top: var(--rule) solid var(--red);
}
.product__gallery {
width: min(100%, 30rem);
}
.product__stage {
display: grid;
overflow: hidden;
background: var(--ground);
}
.product__view {
grid-area: 1 / 1;
width: 100%;
height: auto;
opacity: 0;
transition: opacity var(--slow) var(--ease);
}
.product__view.is-active {
opacity: 1;
}
.product__thumbs {
display: flex;
gap: var(--space-s);
margin-top: var(--space-s);
}
.product__thumb {
position: relative;
width: 3.5rem;
height: 3.5rem;
padding: 0;
border: var(--rule) solid transparent;
background: var(--ground);
cursor: pointer;
}
.product__thumb::before {
content: "";
position: absolute;
inset: 18% 30%;
background: var(--cover-mustard);
}
.product__thumb--spread::before {
inset: 30% 12%;
background: linear-gradient(90deg, var(--cover-cream) 49%, var(--ground-shade) 49% 51%, var(--cover-cream) 51%);
}
.product__thumb--back::after {
content: "";
position: absolute;
left: 36%;
bottom: 26%;
width: 16%;
height: 10%;
background: var(--paper);
}
.product__thumb.is-active,
.product__thumb:hover,
.product__thumb:focus-visible {
border-color: var(--red);
outline: none;
}
.product__info > * {
margin: 0;
}
.product__info > * + * {
margin-top: var(--space-m);
}
.product__label {
padding-top: var(--space-xs);
}
.product__title,
.product__price {
font-size: var(--text);
font-weight: 700;
letter-spacing: var(--tracking-bold);
line-height: var(--leading-tight);
}
.product__info .product__price {
margin-top: var(--space-xs);
}
.product__tax {
font-weight: 400;
letter-spacing: var(--tracking);
}
.product__copy {
max-width: 34rem;
}
.product__specs {
border-bottom: var(--rule) solid var(--red);
}
.product__spec {
display: grid;
grid-template-columns: 7rem minmax(0, 1fr);
gap: var(--space-m);
padding-block: var(--space-xs);
border-top: var(--rule) solid var(--red);
}
.product__spec dd {
margin: 0;
}
.product__info .product__buy {
display: flex;
flex-wrap: wrap;
gap: var(--space-s);
margin-top: var(--space-l);
}
.product__stepper {
display: flex;
border: var(--rule) solid var(--red);
}
.product__step,
.product__add {
min-width: var(--tap);
min-height: var(--tap);
border: 0;
border-radius: var(--radius);
font: inherit;
letter-spacing: inherit;
cursor: pointer;
}
.product__step {
background: none;
color: var(--red);
}
.product__step:hover,
.product__step:focus-visible {
background: var(--red);
color: var(--paper);
outline: none;
}
.product__qty {
display: grid;
place-items: center;
min-width: 2.5rem;
border-inline: var(--rule) solid var(--red);
}
.product__add {
flex: 1 1 10rem;
max-width: 16rem;
border: var(--rule) solid var(--red);
background: var(--red);
color: var(--paper);
font-weight: 700;
letter-spacing: var(--tracking-bold);
transition: background-color var(--quick) var(--ease), color var(--quick) var(--ease);
}
.product__add:hover,
.product__add:focus-visible,
.product__add.is-added {
background: var(--paper);
color: var(--red);
outline: none;
}
.product__info .product__status {
margin-top: var(--space-s);
}
.product__count {
display: inline-block;
font-weight: 700;
}
.product__count.is-bumped {
animation: product-bump var(--slow) var(--ease);
}
@keyframes product-bump {
30% { transform: translateY(-4px); }
}
/* Drawn book */
.product__ground { fill: var(--ground); }
.product__shadow { fill: var(--ground-shade); }
.product__fill-mustard { fill: var(--cover-mustard); }
.product__fill-cream { fill: var(--cover-cream); }
.product__fill-paper { fill: var(--paper); }
.product__spine-shade { fill: var(--cover-navy); opacity: 0.12; }
.product__line,
.product__text-lines,
.product__barcode,
.product__gutter {
fill: none;
stroke-linecap: round;
stroke-linejoin: round;
}
.product__line { stroke: var(--cover-navy); stroke-width: 3; }
.product__text-lines { stroke: var(--cover-navy); stroke-width: 2; opacity: 0.55; }
.product__barcode { stroke: var(--cover-navy); stroke-width: 2; stroke-linecap: butt; }
.product__gutter { stroke: var(--ground-shade); stroke-width: 2; }
.product__cover-type,
.product__cover-small {
fill: var(--cover-navy);
font-family: var(--font-text);
}
.product__cover-type {
font-size: 28px;
font-weight: 700;
letter-spacing: -0.02em;
}
.product__cover-small {
font-size: 14px;
}
@media (max-width: 47.99rem) {
.product__body {
grid-template-columns: minmax(0, 1fr);
row-gap: var(--space-l);
}
}
@media (prefers-reduced-motion: reduce) {
.product__view {
transition: none;
}
.product__count.is-bumped {
animation: none;
}
}
</style>
<script>
(() => {
const FLASH_MS = 600;
for (const root of document.querySelectorAll('.product')) {
const views = [...root.querySelectorAll('.product__view')];
const thumbs = [...root.querySelectorAll('.product__thumb')];
const qty = root.querySelector('.product__qty');
const add = root.querySelector('.product__add');
const count = root.querySelector('.product__count');
let inCart = 0;
thumbs.forEach((thumb, index) => {
thumb.addEventListener('click', () => {
thumbs.forEach((other, i) => {
other.classList.toggle('is-active', i === index);
other.setAttribute('aria-pressed', String(i === index));
});
views.forEach((view, i) => view.classList.toggle('is-active', i === index));
});
});
root.querySelectorAll('.product__step').forEach((step) => {
step.addEventListener('click', () => {
const next = Number(qty.textContent) + Number(step.dataset.step);
qty.textContent = String(Math.min(9, Math.max(1, next)));
});
});
add.addEventListener('click', () => {
inCart += Number(qty.textContent);
count.textContent = String(inCart);
add.textContent = 'Added';
add.classList.add('is-added');
count.classList.remove('is-bumped');
void count.offsetWidth;
count.classList.add('is-bumped');
setTimeout(() => {
add.textContent = 'Add to cart';
add.classList.remove('is-added');
}, FLASH_MS * 2);
});
}
})();
</script>