Product Grid 1
Storefront collection band: a full-bleed photo with the shop panel breaking its edge, a sliding collection filter whose
Use it in a prompt
Use offer/product-grid from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/offer/product-grid.tsx. - Import it and pass your copy and images (Props tab):
import { ProductGrid } from "@/components/funneldna/offer/product-grid"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/product-grid/component.tsx 523 lines
// layout: photo-overlap-card
// Storefront collection band: a full-bleed photo with the shop panel breaking its edge, a sliding collection filter whose
// sales subhead changes with the pick, and product tiles with rating, coupon saving, price and a two-line quick add.
import * as React from "react"
import { AnimatePresence, LayoutGroup, motion, useReducedMotion } from "motion/react"
import { AlertCircle, Loader2, Scissors, ShieldCheck, ShoppingBag, Star } from "lucide-react"
export type ProductGridProduct = {
id: string // stable key for the tile
name: string
category?: string // id of the collection in `categories`
image?: string // product photo (slot product / item-n)
imageAlt?: string
detail?: React.ReactNode // one short line under the name, hidden on phones
price: string
compareAt?: string // regular price: struck through, and the coupon saving is worked out from it
rating?: number // supplied average out of 5; omit when not supplied
reviewCount?: number | string
flag?: string // short flag above the name, e.g. "Best value", only when true
addSub?: string // second line inside the add button (falls back to copy.addSub)
href?: string // product page for the photo and name
available?: boolean // false disables the add button
}
export type ProductGridCategory = {
id: string
label: string
pitch?: React.ReactNode // sales subhead shown while this collection is picked
}
export type ProductGridCopy = {
addLabel: string
addSub: string
addingLabel: string
unavailableLabel: string
addFor: string // screen-reader suffix on the add button; {name}
saving: string // coupon line; {amount}
nowLabel: string
wasLabel: string
reviews: string // {count}
ratingLabel: string // {rating}, {count}
ratingOnlyLabel: string // {rating}
error: string
empty: string
filterLabel: string
}
export type ProductGridProps = {
headline?: React.ReactNode
lead?: React.ReactNode
heroImage?: string // full-bleed photo behind the headline (slot scene)
heroImageAlt?: string // leave empty when the photo is decorative
categories?: ProductGridCategory[]
allLabel?: string
allPitch?: React.ReactNode // sales subhead while "All" is picked
products?: ProductGridProduct[]
note?: React.ReactNode // reassurance line under the grid (the supplied guarantee)
copy?: Partial<ProductGridCopy>
onAction?: (product: ProductGridProduct) => void | Promise<unknown> // quick add; a returned promise shows loading, a rejection the inline error
state?: "default" | "hover" | "disabled" | "error"
className?: string
}
const DEFAULT_COPY: ProductGridCopy = {
addLabel: "Add to cart",
addSub: "Instant download",
addingLabel: "Adding…",
unavailableLabel: "Unavailable",
addFor: ", {name}",
saving: "Save {amount}",
nowLabel: "Price:",
wasLabel: "Regular price:",
reviews: "({count})",
ratingLabel: "Rated {rating} out of 5 from {count} reviews",
ratingOnlyLabel: "Rated {rating} out of 5",
error: "We couldn’t add this to your cart. Please try again.",
empty: "Nothing in this collection yet. Try another one.",
filterLabel: "Filter products by collection",
}
const EASE = [0.2, 0.7, 0.2, 1] as const
export function ProductGrid(props: ProductGridProps) {
const {
headline = "Pick the tools that get your funnel live",
lead = "Plan the pages, write the words and check every step. Take one tool, or the whole kit.",
heroImage,
heroImageAlt = "",
categories = [],
allLabel = "All",
allPitch = "Start with the one tool you need tonight",
products = [],
note,
copy: copyProp,
onAction,
state = "default",
className,
} = props
const copy: ProductGridCopy = { ...DEFAULT_COPY, ...copyProp }
const reduce = useReducedMotion() ?? false
const uid = React.useId()
const headId = `${uid}-title`
const [picked, setPicked] = React.useState("all")
const collections = categories.filter((c) => products.some((p) => p.category === c.id))
const current = picked === "all" || collections.some((c) => c.id === picked) ? picked : "all"
const shown = current === "all" ? products : products.filter((p) => p.category === current)
const pitch = current === "all" ? allPitch : collections.find((c) => c.id === current)?.pitch
const filters = [
{ id: "all", label: allLabel, count: products.length },
...collections.map((c) => ({ id: c.id, label: c.label, count: products.filter((p) => p.category === c.id).length })),
]
return (
<section className={["cf-product-grid", className].filter(Boolean).join(" ")} aria-labelledby={headId}>
<style>{CSS}</style>
<div className="pg-hero">
{heroImage ? (
<img
className="pg-hero-img"
src={heroImage}
alt={heroImageAlt}
aria-hidden={heroImageAlt ? undefined : true}
width={1600}
height={900}
decoding="async"
/>
) : null}
<div className="pg-scrim" aria-hidden="true" />
<div className="pg-wrap">
<div className="pg-copy">
<h2 id={headId} className="pg-headline">
{headline}
</h2>
{lead ? <p className="pg-lead">{lead}</p> : null}
</div>
</div>
</div>
<div className="pg-wrap">
<div className="pg-panel">
{filters.length > 1 ? (
<LayoutGroup id={`${uid}-filters`}>
<div className="pg-filters" role="group" aria-label={copy.filterLabel}>
{filters.map((f) => {
const on = f.id === current
return (
<button key={f.id} type="button" className="pg-filter" aria-pressed={on} onClick={() => setPicked(f.id)}>
{on ? (
<motion.span
layoutId="pg-pill"
className="pg-pill"
aria-hidden="true"
transition={reduce ? { duration: 0 } : { type: "spring", stiffness: 520, damping: 40 }}
/>
) : null}
<span className="pg-filter-label">{f.label}</span>
<span className="pg-filter-count">{f.count}</span>
</button>
)
})}
</div>
</LayoutGroup>
) : null}
{pitch ? (
<p className="pg-pitch" aria-live="polite">
<AnimatePresence mode="wait" initial={false}>
<motion.span
key={current}
className="pg-pitch-line"
initial={reduce ? false : { opacity: 0, y: 6 }}
animate={{ opacity: 1, y: 0 }}
exit={reduce ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, y: -4, transition: { duration: 0.12 } }}
transition={{ duration: 0.24, ease: EASE }}
>
{pitch}
</motion.span>
</AnimatePresence>
</p>
) : null}
{shown.length ? (
<ul className="pg-grid">
<AnimatePresence mode="popLayout" initial={!reduce}>
{shown.map((product, i) => (
<motion.li
key={product.id}
layout={!reduce}
className={"pg-tile" + (state === "hover" && i === 0 ? " is-hover" : "")}
initial={reduce ? false : { opacity: 0.82, y: 8 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={reduce ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, scale: 0.96, transition: { duration: 0.16 } }}
transition={{ duration: 0.45, ease: EASE, delay: reduce ? 0 : Math.min(i * 0.07, 0.28), layout: { duration: 0.35, ease: EASE } }}
>
<TileBody
product={product}
copy={copy}
onAction={onAction}
disabled={state === "disabled"}
forceError={state === "error" && i === 0}
/>
</motion.li>
))}
</AnimatePresence>
</ul>
) : (
<p className="pg-empty">{copy.empty}</p>
)}
{note ? (
<p className="pg-note">
<ShieldCheck className="pg-note-icon" size={18} strokeWidth={2.5} aria-hidden="true" />
{note}
</p>
) : null}
</div>
</div>
</section>
)
}
export default ProductGrid
type TileBodyProps = {
product: ProductGridProduct
copy: ProductGridCopy
onAction?: ProductGridProps["onAction"]
disabled: boolean
forceError: boolean
}
function TileBody({ product, copy, onAction, disabled, forceError }: TileBodyProps) {
const [pending, setPending] = React.useState(false)
const [failed, setFailed] = React.useState(false)
const alive = React.useRef(true)
React.useEffect(() => {
alive.current = true
return () => {
alive.current = false
}
}, [])
const errId = React.useId()
const unavailable = product.available === false
const off = disabled || unavailable
const saving = savingOf(product.price, product.compareAt)
const showError = !off && (forceError || failed)
const sub = product.addSub ?? copy.addSub
const hasRating = typeof product.rating === "number" && Number.isFinite(product.rating)
const count = product.reviewCount
const hasCount = count !== undefined && count !== null && count !== ""
const ratingText = hasRating ? (product.rating as number).toFixed(1) : ""
const ratingLabel = hasRating
? fill(hasCount ? copy.ratingLabel : copy.ratingOnlyLabel, { rating: ratingText, count: hasCount ? (count as number | string) : "" })
: ""
const add = () => {
if (off || pending) return
setFailed(false)
let result: void | Promise<unknown> = undefined
try {
result = onAction?.(product)
} catch {
setFailed(true)
return
}
if (result && typeof (result as Promise<unknown>).then === "function") {
setPending(true)
;(result as Promise<unknown>).then(
() => {
if (alive.current) setPending(false)
},
() => {
if (alive.current) {
setPending(false)
setFailed(true)
}
},
)
}
}
const photo = product.image ? (
<img src={product.image} alt={product.imageAlt ?? product.name} width={600} height={600} loading="lazy" decoding="async" />
) : null
return (
<>
{product.href ? (
<a className="pg-media" href={product.href} tabIndex={-1} aria-hidden="true">
{photo}
</a>
) : (
<div className="pg-media">{photo}</div>
)}
<div className="pg-info">
{product.flag || hasRating ? (
<div className="pg-meta">
{product.flag ? <span className="pg-flag">{product.flag}</span> : null}
{hasRating ? (
<span className="pg-rating" role="img" aria-label={ratingLabel}>
<Star className="pg-star" size={16} strokeWidth={2.5} fill="currentColor" aria-hidden="true" />
<span aria-hidden="true">{ratingText}</span>
{hasCount ? (
<span className="pg-reviews" aria-hidden="true">
{fill(copy.reviews, { count: count as number | string })}
</span>
) : null}
</span>
) : null}
</div>
) : null}
<h3 className="pg-name">{product.href ? <a href={product.href}>{product.name}</a> : product.name}</h3>
{product.detail ? <p className="pg-detail">{product.detail}</p> : null}
<div className="pg-buy">
{saving ? (
<p className="pg-coupon">
<Scissors size={16} strokeWidth={2.5} aria-hidden="true" />
{fill(copy.saving, { amount: saving })}
</p>
) : null}
<p className="pg-price">
<span className="pg-sr">{copy.nowLabel} </span>
<span className="pg-now">{product.price}</span>
{product.compareAt ? (
<s className="pg-was">
<span className="pg-sr">{copy.wasLabel} </span>
{product.compareAt}
</s>
) : null}
</p>
<button
type="button"
className={"pg-add" + (pending ? " is-pending" : "")}
disabled={off}
aria-busy={pending || undefined}
aria-describedby={showError ? errId : undefined}
onClick={add}
>
<span className="pg-add-main">
{pending ? (
<Loader2 className="pg-spin" size={20} strokeWidth={2.5} aria-hidden="true" />
) : (
<ShoppingBag className="pg-bag" size={20} strokeWidth={2.5} aria-hidden="true" />
)}
{pending ? copy.addingLabel : unavailable ? copy.unavailableLabel : copy.addLabel}
<span className="pg-sr">{fill(copy.addFor, { name: product.name })}</span>
</span>
{!unavailable && sub ? <span className="pg-add-sub">{sub}</span> : null}
</button>
{showError ? (
<p className="pg-error" id={errId} role="alert">
<AlertCircle size={16} strokeWidth={2.5} aria-hidden="true" />
{copy.error}
</p>
) : null}
</div>
</div>
</>
)
}
function parseMoney(value: string) {
const m = value.trim().match(/^([^0-9]*)([0-9][0-9,]*(?:[.][0-9]+)?)([^0-9]*)$/)
if (!m) return null
return { prefix: m[1], amount: Number(m[2].split(",").join("")), suffix: m[3] }
}
function savingOf(price: string, compareAt?: string) {
if (!compareAt) return null
const now = parseMoney(price)
const was = parseMoney(compareAt)
if (!now || !was || now.prefix !== was.prefix || now.suffix !== was.suffix) return null
const diff = Math.round((was.amount - now.amount) * 100) / 100
if (!(diff > 0)) return null
const digits = Number.isInteger(diff) ? 0 : 2
return `${now.prefix}${diff.toLocaleString("en-US", { minimumFractionDigits: digits, maximumFractionDigits: digits })}${now.suffix}`
}
function fill(template: string, values: Record<string, string | number>) {
return template.replace(/[{]([A-Za-z]+)[}]/g, (match, key: string) => (key in values ? String(values[key]) : match))
}
// Theme notes: every colour is a token or an OKLCH recipe on a token. The sales subhead uses --subhead-ink, else the
// text-safe --accent (fitted to 4.5:1 on card and surface). The collection filter chips read --button-2-border (a
// transparent 1px edge by default, the theme's outline when it sets one; padding is 1px less so the box is unchanged).
// The `black` in the phone filter mask is an alpha mask, not a colour.
const CSS = `
.cf-product-grid{
--pg-gutter:clamp(16px,5vw,48px);
--pg-overlap:clamp(88px,11vw,168px);
--pg-sh:var(--shadow,oklch(0.22 0.03 256));
--pg-subhead:var(--subhead-ink,var(--accent));
--pg-ring:oklch(from var(--field-focus,var(--accent)) l c h / 0.55);
position:relative;
background:var(--surface);
color:var(--ink);
font-family:var(--font-body);
padding-bottom:clamp(64px,8.5vw,120px);
overflow-x:clip;
}
.cf-product-grid *,.cf-product-grid *::before,.cf-product-grid *::after{box-sizing:border-box}
.cf-product-grid .pg-wrap{width:100%;max-width:calc(1120px + 2 * var(--pg-gutter));margin-inline:auto;padding-inline:var(--pg-gutter)}
.cf-product-grid .pg-hero{position:relative;isolation:isolate;overflow:hidden;background:var(--band);color:var(--band-ink);padding-top:clamp(56px,8vw,112px);padding-bottom:calc(var(--pg-overlap) + clamp(40px,5vw,72px))}
.cf-product-grid .pg-hero-img{position:absolute;inset:0;z-index:-2;display:block;width:100%;height:100%;object-fit:cover;object-position:72% 45%;animation:pg-settle 1.4s cubic-bezier(.2,.7,.2,1) both}
.cf-product-grid .pg-scrim{position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,oklch(from var(--band) l c h / 0.92) 0%,oklch(from var(--band) l c h / 0.86) 50%,oklch(from var(--band) l c h / 0.4) 78%,oklch(from var(--band) l c h / 0.12) 100%)}
.cf-product-grid .pg-copy{max-width:34rem}
.cf-product-grid .pg-headline{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;text-wrap:balance;color:var(--band-ink)}
.cf-product-grid .pg-lead{margin:16px 0 0;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;text-wrap:pretty;color:var(--band-ink)}
.cf-product-grid .pg-panel{position:relative;display:flex;flex-direction:column;gap:24px;margin-top:calc(-1 * var(--pg-overlap));padding:clamp(20px,3vw,40px);background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(from var(--pg-sh) l c h / 0.22),0 12px 24px -8px oklch(from var(--pg-sh) l c h / 0.32)))}
.cf-product-grid .pg-filters{display:flex;gap:8px;margin:-6px;padding:6px;overflow-x:auto;scrollbar-width:none;overscroll-behavior-x:contain}
.cf-product-grid .pg-filters::-webkit-scrollbar{display:none}
.cf-product-grid .pg-filter{position:relative;flex:0 0 auto;display:inline-flex;align-items:center;gap:8px;min-height:44px;margin:0;padding:0 9px 0 15px;border:1px solid var(--button-2-border,transparent);border-radius:999px;background:color-mix(in oklch,var(--ink) 5%,var(--card));color:var(--ink);font-family:var(--font-body);font-size:1rem;font-weight:700;line-height:1.2;white-space:nowrap;cursor:pointer;transition:background-color .16s ease,color .16s ease;-webkit-tap-highlight-color:transparent}
.cf-product-grid .pg-filter:hover{background:color-mix(in oklch,var(--ink) 10%,var(--card))}
.cf-product-grid .pg-filter:focus-visible{outline:3px solid var(--pg-ring);outline-offset:2px}
.cf-product-grid .pg-filter[aria-pressed=true]{background:transparent;color:var(--card)}
.cf-product-grid .pg-pill{position:absolute;inset:-1px;z-index:0;border-radius:inherit;background:var(--ink)}
.cf-product-grid .pg-filter-label,.cf-product-grid .pg-filter-count{position:relative;z-index:1}
.cf-product-grid .pg-filter-count{display:inline-grid;place-items:center;min-width:26px;height:26px;padding:0 8px;border-radius:999px;background:oklch(from var(--ink) l c h / 0.08);font-size:.875rem;font-weight:800;font-variant-numeric:tabular-nums}
.cf-product-grid .pg-filter[aria-pressed=true] .pg-filter-count{background:oklch(from var(--card) l c h / 0.2)}
.cf-product-grid .pg-pitch{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;color:var(--pg-subhead);text-wrap:balance}
.cf-product-grid .pg-pitch-line{display:block}
.cf-product-grid .pg-grid{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:32px 24px}
.cf-product-grid .pg-tile{display:flex;flex-direction:column;min-width:0;margin:0}
.cf-product-grid .pg-media{position:relative;display:block;aspect-ratio:1 / 1;overflow:hidden;border-radius:12px;background:color-mix(in oklch,var(--ink) 4%,var(--card))}
.cf-product-grid .pg-media img{display:block;width:100%;height:100%;object-fit:cover;object-position:center;transition:transform .45s cubic-bezier(.2,.7,.2,1)}
.cf-product-grid .pg-tile.is-hover .pg-media img{transform:scale(1.04)}
@media (hover:hover){.cf-product-grid .pg-tile:hover .pg-media img{transform:scale(1.04)}}
.cf-product-grid .pg-info{display:flex;flex:1;flex-direction:column;padding-top:16px}
.cf-product-grid .pg-meta{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-height:28px;margin-bottom:8px}
.cf-product-grid .pg-flag{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));font-size:.875rem;font-weight:800;line-height:1.2;white-space:nowrap}
.cf-product-grid .pg-rating{display:inline-flex;align-items:center;gap:4px;font-size:.9375rem;font-weight:700;line-height:1.2;color:var(--ink);font-variant-numeric:tabular-nums}
.cf-product-grid .pg-star{flex:0 0 auto;color:var(--accent-fill,var(--accent))}
.cf-product-grid .pg-reviews{font-weight:500;color:var(--muted)}
.cf-product-grid .pg-name{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.2;letter-spacing:-0.01em;text-wrap:balance;color:var(--ink)}
.cf-product-grid .pg-name a{color:inherit;text-decoration:none;border-radius:4px}
.cf-product-grid .pg-name a:hover{text-decoration:underline;text-decoration-thickness:2px;text-decoration-color:oklch(from var(--ink) l c h / 0.35);text-underline-offset:.18em}
.cf-product-grid .pg-name a:focus-visible{outline:3px solid var(--pg-ring);outline-offset:3px}
.cf-product-grid .pg-detail{margin:8px 0 0;font-size:.9375rem;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-product-grid .pg-buy{display:flex;flex-direction:column;gap:12px;margin-top:auto;padding-top:16px}
.cf-product-grid .pg-coupon{align-self:flex-start;max-width:100%;margin:0;padding:4px 12px;border-radius:999px;background:var(--success-soft);color:var(--success);font-size:.875rem;font-weight:800;line-height:1.5;text-wrap:pretty}
.cf-product-grid .pg-coupon svg{display:inline-block;vertical-align:-0.2em;margin-inline-end:.4em}
.cf-product-grid .pg-price{position:relative;display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px;margin:0}
.cf-product-grid .pg-now{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.625rem,2.2vw,2rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--ink)}
.cf-product-grid .pg-was{font-size:1rem;font-weight:600;line-height:1.2;color:var(--muted);text-decoration:line-through;text-decoration-color:var(--danger);text-decoration-thickness:2px;font-variant-numeric:tabular-nums}
.cf-product-grid .pg-add{
--pg-b:var(--button-bg,var(--cta));
--pg-b2:var(--button-bg-2,var(--cta-2));
position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;width:100%;min-height:60px;margin:0;padding:8px 14px;border:0;
border-radius:var(--button-radius,var(--radius,12px));
background:linear-gradient(oklch(from var(--pg-b) calc(l + 0.04) c h),oklch(from var(--pg-b2) calc(l - 0.02) c h));
color:var(--button-ink,var(--cta-ink));
font-family:var(--button-font,var(--font-display));
text-transform:var(--button-case,none);
text-align:center;
text-shadow:var(--button-text-shadow,none);
box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--pg-b) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--pg-b) calc(l - 0.16) c h),0 1px 2px oklch(from var(--pg-sh) l c h / 0.3),0 8px 16px -6px oklch(from var(--pg-sh) l c h / 0.45));
cursor:pointer;
transition:transform .16s ease,box-shadow .16s ease,background .16s ease;
-webkit-tap-highlight-color:transparent;
}
.cf-product-grid .pg-add-main{display:inline-flex;align-items:center;justify-content:center;gap:8px;font-weight:var(--button-weight,800);font-size:clamp(1.0625rem,1.35vw,1.1875rem);line-height:1.15;white-space:nowrap}
.cf-product-grid .pg-add-main svg{flex:0 0 auto}
.cf-product-grid .pg-add-sub{font-family:var(--font-body);font-size:.875rem;font-weight:600;line-height:1.2;text-wrap:balance}
.cf-product-grid .pg-add:hover:not(:disabled),.cf-product-grid .pg-tile.is-hover .pg-add:not(:disabled){background:linear-gradient(oklch(from var(--pg-b) calc(l - 0.01) c h),oklch(from var(--pg-b2) calc(l - 0.07) c h));box-shadow:inset 0 1px 0 oklch(from var(--pg-b) calc(l + 0.1) c h / 0.6),inset 0 -3px 0 oklch(from var(--pg-b) calc(l - 0.2) c h),0 1px 2px oklch(from var(--pg-sh) l c h / 0.32),0 10px 18px -6px oklch(from var(--pg-sh) l c h / 0.52);transform:translateY(-1px)}
.cf-product-grid .pg-add:active:not(:disabled){transform:translateY(1px);box-shadow:inset 0 2px 4px oklch(from var(--pg-b) calc(l - 0.22) c h / 0.55),inset 0 -2px 0 oklch(from var(--pg-b) calc(l - 0.16) c h),0 1px 2px oklch(from var(--pg-sh) l c h / 0.3)}
.cf-product-grid .pg-add:focus-visible{outline:3px solid var(--pg-ring);outline-offset:3px}
.cf-product-grid .pg-add.is-pending{cursor:progress}
.cf-product-grid .pg-add:disabled{background:var(--secondary,color-mix(in oklch,var(--ink) 8%,var(--card)));color:var(--secondary-ink,var(--ink));text-shadow:none;box-shadow:var(--button-2-shadow,var(--shadow-sm));cursor:not-allowed;transform:none}
.cf-product-grid .pg-add:disabled .pg-add-main,.cf-product-grid .pg-add:disabled .pg-add-sub{opacity:.72}
.cf-product-grid .pg-spin{animation:pg-spin .8s linear infinite}
.cf-product-grid .pg-error{margin:0;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--danger);text-wrap:pretty}
.cf-product-grid .pg-error svg{display:inline-block;vertical-align:-0.2em;margin-inline-end:.4em}
.cf-product-grid .pg-empty{margin:0;padding:32px 24px;border-radius:10px;background:color-mix(in oklch,var(--ink) 4%,var(--card));text-align:center;color:var(--ink);font-size:1.0625rem;line-height:1.5}
.cf-product-grid .pg-note{margin:8px 0 0;text-align:center;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-product-grid .pg-note-icon{display:inline-block;vertical-align:-0.2em;margin-inline-end:.4em;color:var(--success)}
.cf-product-grid .pg-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@keyframes pg-spin{to{transform:rotate(360deg)}}
@keyframes pg-settle{from{transform:scale(1.06)}to{transform:scale(1)}}
@media (max-width:959px){
.cf-product-grid .pg-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (max-width:719px){
.cf-product-grid .pg-scrim{background:linear-gradient(180deg,oklch(from var(--band) l c h / 0.9) 0%,oklch(from var(--band) l c h / 0.78) 100%)}
.cf-product-grid .pg-hero-img{object-position:68% 50%}
.cf-product-grid .pg-copy{max-width:none}
.cf-product-grid .pg-panel{padding:20px 16px}
.cf-product-grid .pg-filters{padding:6px 32px 6px 6px;-webkit-mask-image:linear-gradient(90deg,black calc(100% - 32px),transparent);mask-image:linear-gradient(90deg,black calc(100% - 32px),transparent)}
.cf-product-grid .pg-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:28px 12px}
.cf-product-grid .pg-info{padding-top:12px}
.cf-product-grid .pg-meta{gap:6px}
.cf-product-grid .pg-name{font-size:1.0625rem;line-height:1.2}
.cf-product-grid .pg-detail{display:none}
.cf-product-grid .pg-buy{gap:8px;padding-top:12px}
.cf-product-grid .pg-price{margin-bottom:4px}
.cf-product-grid .pg-now{font-size:1.5rem}
.cf-product-grid .pg-was{font-size:.9375rem}
.cf-product-grid .pg-add{min-height:56px;padding:8px 10px}
.cf-product-grid .pg-add-main{font-size:1rem;gap:6px}
.cf-product-grid .pg-add-main svg{width:18px;height:18px}
}
@media (max-width:479px){
.cf-product-grid .pg-add{min-height:52px;padding:8px}
.cf-product-grid .pg-add .pg-bag,.cf-product-grid .pg-add-sub{display:none}
.cf-product-grid .pg-add-main{font-size:1rem}
}
@media (prefers-reduced-motion:reduce){
.cf-product-grid .pg-hero-img,.cf-product-grid .pg-spin{animation:none}
.cf-product-grid .pg-add,.cf-product-grid .pg-filter,.cf-product-grid .pg-media img{transition:none}
.cf-product-grid .pg-tile:hover .pg-media img,.cf-product-grid .pg-tile.is-hover .pg-media img{transform:none}
.cf-product-grid .pg-add:hover:not(:disabled),.cf-product-grid .pg-tile.is-hover .pg-add:not(:disabled),.cf-product-grid .pg-add:active:not(:disabled){transform:none}
}
`
pieces/offer/product-grid/specimen.tsx 86 lines
import __studioImage49d87dd6 from "../assets/b530b1fb7ecfa6df.webp";
import __studioImage396aa16d from "../assets/0c231523072946c9.webp";
import * as React from "react"
import { ProductGrid } from "../product-grid"
import defaults from "../../studio-defaults.json"
import { slot } from "../../slots"
export const states = ["default", "hover", "disabled", "error"]
type SpecimenState = "default" | "hover" | "disabled" | "error"
export default function ProductGridSpecimen({ state = "default" }: { state?: SpecimenState }) {
const sample = defaults.sample
const [guide, workbook, checklist] = sample.items
return (
<ProductGrid
state={state}
headline={sample.headline}
lead="Plan your funnel, write your page copy, and check every step before you launch. Take one tool, or the whole kit."
heroImage={slot(
"scene",
__studioImage49d87dd6,
)}
allLabel="All tools"
allPitch="Start with the one tool you need tonight"
categories={[
{ id: "kit", label: "Complete kit", pitch: "Take all three tools and save $50" },
{ id: "plan", label: "Plan", pitch: "Map every page before you build one" },
{ id: "write", label: "Write", pitch: "Write the words that make people click" },
{ id: "launch", label: "Launch", pitch: "Check every link before your traffic arrives" },
]}
products={[
{
id: "kit",
name: sample.name,
category: "kit",
image: slot(
"product",
__studioImage396aa16d,
),
imageAlt: "The Funnel Starter Kit: the guide, workbook and checklist together",
detail: "The guide, workbook and checklist in one download.",
price: sample.price,
compareAt: sample.regularPrice,
rating: 4.9,
reviewCount: 212,
flag: "Best value",
},
{
id: "guide",
name: guide.name,
category: "plan",
image: slot("item-1", guide.image),
imageAlt: guide.imageAlt,
detail: guide.detail,
price: guide.value,
rating: 4.8,
reviewCount: 136,
},
{
id: "workbook",
name: workbook.name,
category: "write",
image: slot("item-2", workbook.image),
imageAlt: workbook.imageAlt,
detail: workbook.detail,
price: workbook.value,
rating: 4.7,
reviewCount: 94,
},
{
id: "checklist",
name: checklist.name,
category: "launch",
image: slot("item-3", checklist.image),
imageAlt: checklist.imageAlt,
detail: checklist.detail,
price: checklist.value,
rating: 4.9,
reviewCount: 118,
},
]}
note={`${sample.guarantee} · Instant digital access`}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalProductGrid |
React.ReactNode |
|
lead OptionalProductGrid |
React.ReactNode |
|
heroImage OptionalProductGrid |
string |
|
heroImageAlt OptionalProductGrid |
string |
|
categories OptionalProductGrid |
ProductGridCategory[] |
|
allLabel OptionalProductGrid |
string |
|
allPitch OptionalProductGrid |
React.ReactNode |
|
products OptionalProductGrid |
ProductGridProduct[] |
|
note OptionalProductGrid |
React.ReactNode |
|
copy OptionalProductGrid |
Partial<ProductGridCopy> |
|
onAction OptionalProductGrid |
(product: ProductGridProduct) => void | Promise<unknown> |
|
state OptionalProductGrid |
"default" | "hover" | "disabled" | "error" |
|
className OptionalProductGrid |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-border--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field-focus- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-1- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-2- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-3- One image per offer item (item-1, item-2…), shown in stacks and lists.
product- The main product shot or cover (ebook, kit, bottle).
scene- A wide atmosphere photo behind or beside the copy.
-
0c231523072946c9.webp
image/webp · 87.9 KB
-
b530b1fb7ecfa6df.webp
image/webp · 60.9 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB