Treasure Map Hero 1
Treasure-map hero: a dotted route climbs from "You are here" past each item in the offer to an X beside
Use it in a prompt
Use attention/treasure-map-hero 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/attention/treasure-map-hero.tsx. - Import it and pass your copy and images (Props tab):
import { TreasureMapHero } from "@/components/funneldna/attention/treasure-map-hero"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/attention/treasure-map-hero/component.tsx 896 lines
// layout: price-staircase
// Treasure-map hero: a dotted route climbs from "You are here" past each item in the offer to an X beside
// the call to action, then an itemised value ledger, the price and numbered reasons close the sale.
import React, { useEffect, useRef, useState } from "react"
import { Check, MapPin, Pause, Play } from "lucide-react"
import { Mark } from "../marks/marks"
export type TreasureMapStop = {
/** Item name: shown on the stop card, in the ledger and as the image alt fallback. */
name: string
/** Value shown in the ledger, e.g. "$49". Items without a value are left out of the ledger. */
value?: string
/** item-n slot: product photo shown at the stop. */
image?: string
/** Alt text for the stop image; defaults to the item name. */
imageAlt?: string
}
export type TreasureMapHeroProps = {
headline?: string
/** Phrase inside the headline that gets one marker stroke. */
highlight?: string
/** Supporting line under the headline. */
lead?: string
/** Product name above the button. */
productName?: string
/** Button action line. */
label?: string
/** Button benefit line, inside the button under the action. */
sublabel?: string
/** Navigation destination; renders the button as a link when set and enabled. */
href?: string
/** Called on button click (after href navigation is allowed); not called while disabled. */
onAction?: (event: React.MouseEvent<HTMLElement>) => void
disabled?: boolean
/** Route stops from left to right (designed for 3, up to 5). */
items?: TreasureMapStop[]
/** Label at the start of the route. */
startLabel?: string
/** "{n}" is replaced with the stop number. */
stopLabel?: string
/** Accessible name of the route list. */
routeLabel?: string
/** Ledger total row label. */
totalLabel?: string
/** Total value shown in the ledger total row; hides the row when empty. */
regularPrice?: string
/** Line beside today's price. */
todayLabel?: string
/** Today's price; hides the price row when empty. */
price?: string
/** Small line under the today label. */
note?: string
/** "{price}" is replaced with the price. */
reasonsHeading?: string
/** Numbered reasons shown in one paragraph. */
reasons?: string[]
/** Short phrases for the scrolling map legend. */
legend?: string[]
/** texture slot: transparent line-art map, tinted with the ink token through a mask. */
mapImage?: string
/** Accessible name of the ambient-motion toggle. */
pauseLabel?: string
/** Forces a button state for previews. */
state?: "default" | "hover" | "active" | "disabled"
className?: string
}
export function TreasureMapHero(props: TreasureMapHeroProps) {
const {
headline = "Build your first funnel with a clear plan",
highlight = "a clear plan",
lead = "Plan your funnel, write your page copy, and check every step before you launch.",
productName = "The Funnel Starter Kit",
label = "Get The Starter Kit",
sublabel = "Secure checkout · Instant download",
href,
onAction,
disabled = false,
items = DEFAULT_ITEMS,
startLabel = "You are here",
stopLabel = "Stop {n}",
routeLabel = "Your route to a finished funnel",
totalLabel = "Total value",
regularPrice = "$97",
todayLabel = "Get the complete kit for",
price = "$47",
note = "One payment · Lifetime access",
reasonsHeading = "Three reasons this is {price}",
reasons = DEFAULT_REASONS,
legend = DEFAULT_LEGEND,
mapImage,
pauseLabel = "Pause map animation",
state = "default",
className,
} = props
const stops = items.slice(0, 5)
const isDisabled = disabled || state === "disabled"
const routeRef = useRef<HTMLDivElement | null>(null)
const buttonRef = useRef<HTMLElement | null>(null)
const [end, setEnd] = useState<Point>({ x: 96, y: 18 })
const [paused, setPaused] = useState(false)
// Keep the route's last leg level with the button: measure the button centre inside the route box.
useEffect(() => {
const route = routeRef.current
const button = buttonRef.current
if (!route || !button || typeof ResizeObserver === "undefined") return
let frame = 0
const measure = () => {
cancelAnimationFrame(frame)
frame = requestAnimationFrame(() => {
const r = route.getBoundingClientRect()
const b = button.getBoundingClientRect()
if (r.width < 1 || r.height < 1) return
const y = ((b.top + b.height / 2 - r.top) / r.height) * 100
const next = { x: round(100 - (33 / r.width) * 100), y: round(Math.min(36, Math.max(6, y))) }
setEnd((prev) => (prev.x === next.x && prev.y === next.y ? prev : next))
})
}
measure()
const observer = new ResizeObserver(measure)
observer.observe(route)
observer.observe(button)
return () => {
observer.disconnect()
cancelAnimationFrame(frame)
}
}, [isDisabled, href])
const points = stops.map((_, i) => stopPoint(i, stops.length))
const path = routePath([START, ...points, end])
const priced = stops.filter((item) => item.value)
const artUrl = mapImage ? `url(${JSON.stringify(mapImage)})` : undefined
const buttonClass = [
"tmh-btn",
state === "hover" ? "is-hover" : "",
state === "active" ? "is-active" : "",
isDisabled ? "is-disabled" : "",
]
.filter(Boolean)
.join(" ")
const setButton = (el: HTMLElement | null) => {
buttonRef.current = el
}
const handleAction = (event: React.MouseEvent<HTMLElement>) => {
if (isDisabled) {
event.preventDefault()
return
}
onAction?.(event)
}
const buttonInner = (
<>
<span className="tmh-btn-main">{label}</span>
{sublabel ? <span className="tmh-btn-sub">{sublabel}</span> : null}
</>
)
return (
<div className={["cf-treasure-map-hero", paused ? "is-paused" : "", className ?? ""].filter(Boolean).join(" ")}>
<style>{CSS}</style>
<div className="tmh-head">
<h1 className="tmh-h1">{renderHeadline(headline, highlight)}</h1>
{lead ? <p className="tmh-lead">{lead}</p> : null}
</div>
<div className="tmh-map">
{artUrl ? (
<div className="tmh-art" aria-hidden="true" style={{ WebkitMaskImage: artUrl, maskImage: artUrl }} />
) : null}
<div className="tmh-route" ref={routeRef} style={{ "--tmh-end-y": `${end.y}%` } as React.CSSProperties}>
<svg className="tmh-svg" viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true" focusable="false">
<path className="tmh-case" d={path} vectorEffect="non-scaling-stroke" />
<path className="tmh-dash" d={path} vectorEffect="non-scaling-stroke" />
</svg>
<span className="tmh-x" aria-hidden="true">
<span className="tmh-x-ink">
<Mark name="cross" width={46} height={46} />
</span>
</span>
<ol className="tmh-stops" aria-label={routeLabel}>
<li className="tmh-stop tmh-start" style={place(START, 0)}>
<span className="tmh-ring" aria-hidden="true" />
<span className="tmh-start-pin" aria-hidden="true">
<MapPin strokeWidth={1.75} />
</span>
<span className="tmh-start-label">{startLabel}</span>
</li>
{stops.map((item, i) => (
<li className="tmh-stop" key={`${item.name}-${i}`} style={place(points[i], i, TILTS[i % TILTS.length])}>
<span className="tmh-pin" aria-hidden="true" />
<figure className="tmh-card">
{item.image ? (
<img src={item.image} alt={item.imageAlt ?? item.name} width={104} height={104} decoding="async" />
) : null}
<figcaption className="tmh-cap">
<span className="tmh-cap-num">{stopLabel.replace("{n}", String(i + 1))}</span>
<span className="tmh-cap-name">{item.name}</span>
</figcaption>
</figure>
</li>
))}
</ol>
</div>
<div className="tmh-cta">
{productName ? <h2 className="tmh-product">{productName}</h2> : null}
{href && !isDisabled ? (
<a ref={setButton} className={buttonClass} href={href} onClick={handleAction}>
{buttonInner}
</a>
) : (
<button ref={setButton} type="button" className={buttonClass} disabled={isDisabled} onClick={handleAction}>
{buttonInner}
</button>
)}
</div>
<div className="tmh-ledger">
{priced.length ? (
<ul className="tmh-rows">
{priced.map((item, i) => (
<li className="tmh-row" key={`${item.name}-${i}`}>
<span className="tmh-row-name">{item.name}</span>
<span className="tmh-leader" aria-hidden="true" />
<span className="tmh-row-val">{item.value}</span>
</li>
))}
</ul>
) : null}
{regularPrice ? (
<p className="tmh-total">
<span>{totalLabel}</span>
<span className="tmh-row-val">{regularPrice}</span>
</p>
) : null}
{price ? (
<div className="tmh-today">
<div className="tmh-today-copy">
{todayLabel ? <p className="tmh-today-label">{todayLabel}</p> : null}
{note ? <p className="tmh-today-note">{note}</p> : null}
</div>
<p className="tmh-price">{price}</p>
</div>
) : null}
</div>
<div className="tmh-reasons">
{reasons.length && reasonsHeading ? (
<h3 className="tmh-reasons-title">{reasonsHeading.replace("{price}", price)}</h3>
) : null}
{reasons.length ? (
<p className="tmh-reasons-copy">
{reasons.map((reason, i) => (
<span className="tmh-reason" key={i}>
<span className="tmh-n">{i + 1}</span>
{reason}{" "}
</span>
))}
</p>
) : null}
</div>
{legend.length ? (
<div className="tmh-ticker">
<div className="tmh-ticker-view" aria-hidden="true">
<div className="tmh-track">
{[0, 1].map((copy) => (
<div className={copy ? "tmh-group tmh-dup" : "tmh-group"} key={copy}>
{[...legend, ...legend].map((text, i) => (
<span className={i >= legend.length ? "tmh-tick tmh-rep" : "tmh-tick"} key={i}>
<Check size={18} strokeWidth={2.75} aria-hidden="true" />
{text}
</span>
))}
</div>
))}
</div>
</div>
<button
type="button"
className="tmh-pause"
aria-label={pauseLabel}
aria-pressed={paused}
onClick={() => setPaused((p) => !p)}
>
{paused ? <Play size={18} aria-hidden="true" /> : <Pause size={18} aria-hidden="true" />}
</button>
</div>
) : null}
</div>
</div>
)
}
export default TreasureMapHero
type Point = { x: number; y: number }
const ROOT = ".cf-treasure-map-hero"
const START: Point = { x: 6, y: 88 }
const TILTS = ["-3deg", "2.5deg", "-2deg", "3deg", "-2.5deg"]
const DEFAULT_ITEMS: TreasureMapStop[] = [
{ name: "Funnel Planning Guide", value: "$49" },
{ name: "Page Copy Workbook", value: "$29" },
{ name: "Launch Checklist", value: "$19" },
]
const DEFAULT_REASONS = [
"Guide, workbook, and checklist in one download.",
"One payment, lifetime access. Yours to keep.",
"Backed by a 30-day money-back guarantee.",
]
const DEFAULT_LEGEND = [
"Funnel Planning Guide",
"Page Copy Workbook",
"Launch Checklist",
"Instant download",
"30-day money-back guarantee",
]
function round(value: number) {
return Math.round(value * 100) / 100
}
// Stops rise left to right like a staircase toward the offer.
function stopPoint(i: number, n: number): Point {
const t = n <= 1 ? 0.5 : i / (n - 1)
return { x: round(28 + t * 50), y: round(76 - t * 34) }
}
function routePath(points: Point[]) {
let d = `M${points[0].x} ${points[0].y}`
for (let i = 1; i < points.length; i++) {
const p = points[i - 1]
const q = points[i]
const dx = q.x - p.x
const sag = i % 2 === 1 ? 5 : -3
const last = i === points.length - 1
const c1 = { x: p.x + dx * 0.4, y: p.y + sag }
const c2 = last ? { x: q.x - dx * 0.45, y: q.y } : { x: q.x - dx * 0.4, y: q.y + sag }
d += ` C${round(c1.x)} ${round(c1.y)} ${round(c2.x)} ${round(c2.y)} ${round(q.x)} ${round(q.y)}`
}
return d
}
function place(p: Point, i: number, tilt = "0deg"): React.CSSProperties {
return { "--x": `${p.x}%`, "--y": `${p.y}%`, "--i": String(i), "--tilt": tilt } as React.CSSProperties
}
function renderHeadline(text: string, phrase?: string) {
if (!phrase) return text
const at = text.toLowerCase().indexOf(phrase.toLowerCase())
if (at < 0) return text
return (
<>
{text.slice(0, at)}
<span className="tmh-hl">{text.slice(at, at + phrase.length)}</span>
{text.slice(at + phrase.length)}
</>
)
}
// "&" stands for the scoped root and is expanded below.
// Theme notes: every colour is a token or an OKLCH recipe on a token; hex only appears as a var() fallback.
// The marker defaults to a translucent tint of --warning (the highlighter's base hue) so it reads on light and
// dark themes alike. The ticker's edge fade is a mask, which reads only alpha, so it uses the opaque --ink token.
// The reduced-motion block keeps !important: its `& *` selectors are less specific than the animated rules
// (e.g. `& .tmh-card img`), so dropping it would let those animations run.
const RAW = `
& {
--tmh-marker: var(--marker, oklch(from var(--warning, #b7791f) l c h / 0.38));
--tmh-route: var(--ink, #1b2333);
--tmh-well: color-mix(in oklch, var(--ink, #1b2333) 4%, var(--card, #ffffff));
--tmh-well-2: color-mix(in oklch, var(--ink, #1b2333) 8%, var(--card, #ffffff));
--tmh-shadow: var(--shadow, oklch(0.22 0.03 260));
container-type: inline-size;
position: relative;
width: 100%;
color: var(--ink, #1b2333);
font-family: var(--font-body, sans-serif);
}
& *, & *::before, & *::after { box-sizing: border-box; }
& .tmh-head { text-align: center; }
& .tmh-h1 {
margin: 0;
color: var(--ink, #1b2333);
font-family: var(--font-display, sans-serif);
font-weight: var(--display-weight, 900);
text-transform: var(--display-case, none);
letter-spacing: var(--display-tracking, -0.025em);
font-size: clamp(2.05rem, 6.2cqi, 4.9rem);
line-height: 1.02;
text-wrap: balance;
}
& .tmh-hl {
background-image: linear-gradient(176deg, transparent 0 46%, var(--tmh-marker) 47% 89%, transparent 90%);
background-repeat: no-repeat;
background-size: 100% 100%;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
padding-inline: 0.06em;
border-radius: 0.18em;
animation: tmh-ink 0.8s cubic-bezier(.3,.7,.2,1) 0.3s both;
}
& .tmh-lead {
margin: 1.4rem auto 0;
max-width: 60ch;
color: var(--muted, #475467);
font-size: clamp(1.0625rem, 1.7cqi, 1.3rem);
font-weight: 500;
line-height: 1.5;
text-wrap: pretty;
}
& .tmh-map {
position: relative;
display: grid;
grid-template-columns: minmax(0, 1fr) 380px;
grid-template-rows: auto auto 1fr auto;
grid-template-areas: "route cta" "route ledger" "route reasons" "ticker ticker";
margin-top: clamp(1.75rem, 3cqi, 2.75rem);
overflow: hidden;
border: 1px solid var(--card-border, color-mix(in oklch, var(--ink, #1b2333) 12%, transparent));
border-radius: var(--card-radius, calc(var(--radius, 12px) * 1.5));
background: var(--card, #ffffff);
box-shadow: var(--card-shadow, var(--shadow-lg, 0 2px 4px oklch(0.22 0.03 260 / 0.22), 0 12px 24px -8px oklch(0.22 0.03 260 / 0.32)));
}
& .tmh-map > * { position: relative; z-index: 1; }
& .tmh-map > .tmh-art {
position: absolute;
z-index: 0;
inset: -3%;
background-color: oklch(from var(--ink, #1b2333) l c h / 0.2);
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-position: 30% 60%;
mask-position: 30% 60%;
-webkit-mask-size: cover;
mask-size: cover;
pointer-events: none;
animation: tmh-drift 40s ease-in-out infinite alternate;
}
& .tmh-route {
grid-area: route;
min-height: 620px;
background-image:
linear-gradient(oklch(from var(--ink, #1b2333) l c h / 0.045) 1px, transparent 1px),
linear-gradient(90deg, oklch(from var(--ink, #1b2333) l c h / 0.045) 1px, transparent 1px);
background-size: 72px 72px;
}
& .tmh-svg {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
overflow: visible;
animation: tmh-wipe 1.8s cubic-bezier(.45,0,.2,1) 0.2s both;
}
& .tmh-case { fill: none; stroke: var(--card, #ffffff); stroke-width: 10px; stroke-linecap: round; stroke-linejoin: round; }
& .tmh-dash {
fill: none;
stroke: var(--tmh-route);
stroke-width: 3.5px;
stroke-linecap: round;
stroke-linejoin: round;
stroke-dasharray: 9 9;
animation: tmh-march 1.2s linear infinite;
}
& .tmh-x {
position: absolute;
z-index: 3;
left: 100%;
top: var(--tmh-end-y, 18%);
width: 46px;
height: 46px;
margin-left: -56px;
transform: translateY(-50%);
color: var(--button-bg, var(--cta, #d92d20));
pointer-events: none;
}
& .tmh-x-ink {
display: block;
width: 100%;
height: 100%;
animation: tmh-x-in 0.5s cubic-bezier(.2,.9,.3,1.3) 1.7s both, tmh-x-pulse 2.8s ease-in-out 2.4s infinite;
}
& .tmh-x svg { display: block; width: 100%; height: 100%; }
& .tmh-stops { position: absolute; inset: 0; z-index: 2; margin: 0; padding: 0; list-style: none; }
& .tmh-stop { position: absolute; left: var(--x); top: var(--y); width: 0; height: 0; }
& .tmh-pin {
position: absolute;
left: 0;
top: 0;
width: 22px;
height: 22px;
transform: translate(-50%, -50%);
border: 4px solid var(--tmh-route);
border-radius: 50%;
background: var(--card, #ffffff);
box-shadow: var(--shadow-sm, 0 1px 2px oklch(0.22 0.03 260 / 0.25));
animation: tmh-pin-in 0.4s cubic-bezier(.2,.9,.3,1.4) both;
animation-delay: calc(0.45s + var(--i) * 0.35s);
}
& .tmh-card {
position: absolute;
right: -16px;
bottom: 20px;
width: 160px;
margin: 0;
display: grid;
justify-items: center;
gap: 10px;
animation: tmh-pop 0.55s cubic-bezier(.2,.8,.2,1.15) both;
animation-delay: calc(0.5s + var(--i) * 0.35s);
}
& .tmh-card img {
display: block;
width: 104px;
height: 104px;
object-fit: cover;
object-position: center;
border-radius: calc(var(--radius, 12px) * 0.8);
rotate: var(--tilt, 0deg);
filter: drop-shadow(0 2px 2px oklch(from var(--tmh-shadow) l c h / 0.3)) drop-shadow(0 8px 10px oklch(from var(--tmh-shadow) l c h / 0.2));
animation: tmh-float 6s ease-in-out infinite alternate;
animation-delay: calc(var(--i) * -2s);
transition: scale 0.25s ease;
}
& .tmh-card:hover img { scale: 1.05; }
& .tmh-cap {
display: grid;
gap: 2px;
width: 100%;
padding: 8px 12px;
border-radius: calc(var(--radius, 12px) * 0.7);
background: var(--tmh-well);
text-align: center;
}
& .tmh-cap-num { color: var(--ink, #1b2333); font-size: 0.875rem; font-weight: 700; line-height: 1.2; }
& .tmh-cap-name {
color: var(--ink, #1b2333);
font-family: var(--font-display, sans-serif);
font-weight: 800;
font-size: 1rem;
line-height: 1.2;
text-wrap: balance;
}
& .tmh-ring {
position: absolute;
left: 0;
top: 0;
width: 40px;
height: 40px;
margin: -20px 0 0 -20px;
border: 2px solid var(--accent-fill, var(--accent, #2563eb));
border-radius: 50%;
opacity: 0.35;
animation: tmh-ring 2.4s ease-out 0.6s infinite;
}
& .tmh-start-pin {
position: absolute;
left: 0;
top: 0;
width: 34px;
height: 34px;
transform: translate(-50%, -92%);
color: var(--accent, #2563eb);
}
& .tmh-start-pin svg {
display: block;
width: 100%;
height: 100%;
filter: drop-shadow(0 2px 2px oklch(from var(--tmh-shadow) l c h / 0.35));
}
& .tmh-start-pin svg path { fill: var(--accent-fill, var(--accent, #2563eb)); stroke: var(--accent-fill, var(--accent, #2563eb)); }
& .tmh-start-pin svg circle { fill: var(--card, #ffffff); stroke: var(--card, #ffffff); }
& .tmh-start-label {
position: absolute;
left: -22px;
top: 16px;
white-space: nowrap;
padding: 6px 12px;
border-radius: 999px;
background: var(--tmh-well);
color: var(--ink, #1b2333);
font-family: var(--font-display, sans-serif);
font-weight: 800;
font-size: 0.9375rem;
line-height: 1.2;
}
& .tmh-cta { grid-area: cta; display: grid; gap: 14px; padding: 32px 32px 8px; background: var(--tmh-well); }
& .tmh-product {
margin: 0;
color: var(--ink, #1b2333);
font-family: var(--font-display, sans-serif);
font-weight: var(--display-weight, 800);
text-transform: var(--display-case, none);
font-size: clamp(1.35rem, 2.1cqi, 1.75rem);
line-height: 1.15;
text-wrap: balance;
}
& .tmh-btn {
position: relative;
isolation: isolate;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
width: 100%;
min-height: 78px;
margin: 0;
padding: 14px 20px 16px;
border: 1px solid oklch(from var(--button-bg-2, var(--cta-2, #b42318)) calc(l - 0.06) c h);
border-radius: var(--button-radius, var(--radius, 12px));
background: linear-gradient(180deg, oklch(from var(--button-bg, var(--cta, #d92d20)) calc(l + 0.04) c h), var(--button-bg-2, var(--cta-2, #b42318)));
color: var(--button-ink, var(--cta-ink, #ffffff));
text-shadow: var(--button-text-shadow, none);
text-align: center;
text-decoration: none;
cursor: pointer;
box-shadow:
inset 0 1px 0 oklch(from var(--button-bg, var(--cta, #d92d20)) calc(l + 0.14) c h / 0.7),
inset 0 -3px 0 oklch(from var(--button-bg-2, var(--cta-2, #b42318)) calc(l - 0.1) c h),
var(--button-shadow, 0 2px 3px oklch(from var(--tmh-shadow) l c h / 0.4), 0 10px 18px -8px oklch(from var(--tmh-shadow) l c h / 0.55));
transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
-webkit-tap-highlight-color: transparent;
}
& .tmh-btn::after {
content: "";
position: absolute;
inset: 0;
z-index: -1;
background: linear-gradient(105deg, transparent 35%, oklch(from var(--button-bg, var(--cta, #d92d20)) calc(l + 0.2) c h / 0.5) 50%, transparent 65%);
transform: translateX(-120%);
animation: tmh-glint 5.5s ease-in-out 2.2s infinite;
pointer-events: none;
}
& .tmh-btn-main {
font-family: var(--button-font, var(--font-display, sans-serif));
font-weight: var(--button-weight, 800);
text-transform: var(--button-case, none);
font-size: clamp(1.2rem, 2.1cqi, 1.5rem);
line-height: 1.1;
text-wrap: balance;
}
& .tmh-btn-sub { font-size: 0.9375rem; font-weight: 600; line-height: 1.25; text-wrap: pretty; }
& .tmh-btn:hover, & .tmh-btn.is-hover {
background: linear-gradient(180deg, oklch(from var(--button-bg, var(--cta, #d92d20)) calc(l - 0.02) c h), oklch(from var(--button-bg-2, var(--cta-2, #b42318)) calc(l - 0.06) c h));
box-shadow:
inset 0 1px 0 oklch(from var(--button-bg, var(--cta, #d92d20)) calc(l + 0.1) c h / 0.6),
inset 0 -3px 0 oklch(from var(--button-bg-2, var(--cta-2, #b42318)) calc(l - 0.14) c h),
0 3px 4px oklch(from var(--tmh-shadow) l c h / 0.42), 0 14px 22px -8px oklch(from var(--tmh-shadow) l c h / 0.6);
}
& .tmh-btn:active, & .tmh-btn.is-active {
transform: translateY(1px);
box-shadow:
inset 0 2px 4px oklch(from var(--tmh-shadow) l c h / 0.35),
inset 0 -1px 0 oklch(from var(--button-bg-2, var(--cta-2, #b42318)) calc(l - 0.1) c h),
0 1px 2px oklch(from var(--tmh-shadow) l c h / 0.3);
}
& .tmh-btn:focus-visible { outline: 3px solid var(--field-focus, var(--accent, #2563eb)); outline-offset: 3px; }
& .tmh-btn:disabled, & .tmh-btn.is-disabled {
cursor: not-allowed;
transform: none;
border-color: color-mix(in oklch, var(--ink, #1b2333) 14%, transparent);
background: var(--button-2-bg, var(--secondary, #e9edf3));
color: var(--button-2-ink, var(--secondary-ink, #1b2333));
text-shadow: none;
box-shadow: none;
}
& .tmh-btn:disabled::after, & .tmh-btn.is-disabled::after { display: none; }
& .tmh-ledger { grid-area: ledger; padding: 20px 32px 8px; background: var(--tmh-well); }
& .tmh-rows { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
& .tmh-row { display: flex; align-items: baseline; gap: 8px; color: var(--ink, #1b2333); font-size: 1rem; line-height: 1.35; }
& .tmh-row-name { min-width: 0; font-weight: 600; }
& .tmh-leader { flex: 1 1 24px; min-width: 16px; border-bottom: 2px dotted oklch(from var(--ink, #1b2333) l c h / 0.32); transform: translateY(-4px); }
& .tmh-row-val { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
& .tmh-total {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin: 14px 0 0;
padding: 10px 12px;
border-radius: calc(var(--radius, 12px) * 0.6);
background: var(--tmh-well-2);
color: var(--ink, #1b2333);
font-weight: 800;
font-size: 1.0625rem;
line-height: 1.3;
}
& .tmh-today { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; }
& .tmh-today-copy { display: grid; gap: 4px; min-width: 0; }
& .tmh-today-label { margin: 0; color: var(--ink, #1b2333); font-weight: 700; font-size: 1.0625rem; line-height: 1.3; text-wrap: balance; }
& .tmh-today-note { margin: 0; color: var(--ink, #1b2333); font-size: 0.9375rem; font-weight: 500; line-height: 1.35; text-wrap: pretty; }
& .tmh-price {
flex: none;
margin: 0;
color: var(--ink, #1b2333);
font-family: var(--font-display, sans-serif);
font-weight: var(--display-weight, 900);
font-size: clamp(2.5rem, 4.2cqi, 3.1rem);
line-height: 1;
letter-spacing: -0.02em;
font-variant-numeric: tabular-nums;
}
& .tmh-reasons { grid-area: reasons; padding: 20px 32px 32px; background: var(--tmh-well); }
& .tmh-reasons-title {
margin: 0 0 10px;
color: var(--ink, #1b2333);
font-family: var(--font-display, sans-serif);
font-weight: var(--display-weight, 800);
text-transform: var(--display-case, none);
font-size: 1.1875rem;
line-height: 1.2;
text-wrap: balance;
}
& .tmh-reasons-copy { margin: 0; color: var(--ink, #1b2333); font-size: 1rem; line-height: 1.65; text-wrap: pretty; }
& .tmh-reason { margin-right: 0.3em; }
& .tmh-n {
display: inline-grid;
place-items: center;
width: 1.6em;
height: 1.6em;
margin-right: 0.4em;
border-radius: 999px;
background: var(--band, #1d2b4f);
color: var(--band-ink, #ffffff);
font-size: 0.875rem;
font-weight: 800;
line-height: 1;
vertical-align: 0.08em;
}
& .tmh-ticker {
grid-area: ticker;
display: flex;
align-items: center;
gap: 8px;
min-height: 56px;
padding: 6px 8px 6px 0;
background: var(--tmh-well-2);
}
& .tmh-ticker-view {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
-webkit-mask-image: linear-gradient(90deg, transparent, var(--ink, #1b2333) 32px, var(--ink, #1b2333) calc(100% - 32px), transparent);
mask-image: linear-gradient(90deg, transparent, var(--ink, #1b2333) 32px, var(--ink, #1b2333) calc(100% - 32px), transparent);
}
& .tmh-track { display: flex; width: max-content; animation: tmh-marquee 40s linear infinite; }
& .tmh-group { display: flex; flex: none; align-items: center; gap: 28px; padding-right: 28px; }
& .tmh-tick {
display: inline-flex;
align-items: center;
gap: 8px;
white-space: nowrap;
color: var(--ink, #1b2333);
font-weight: 700;
font-size: 0.9375rem;
line-height: 1.2;
}
& .tmh-tick svg { flex: none; color: var(--success, #12804a); }
& .tmh-ticker:hover .tmh-track, & .tmh-ticker:focus-within .tmh-track { animation-play-state: paused; }
& .tmh-pause {
flex: none;
display: inline-grid;
place-items: center;
width: 44px;
height: 44px;
padding: 0;
border: 1px solid var(--button-2-border, transparent);
border-radius: var(--button-radius, var(--radius, 10px));
background: var(--button-2-bg, var(--secondary, #e9edf3));
color: var(--button-2-ink, var(--secondary-ink, #1b2333));
box-shadow: var(--button-2-shadow, var(--shadow-sm));
cursor: pointer;
transition: background 0.15s ease;
}
& .tmh-pause:hover { background: oklch(from var(--button-2-bg, var(--secondary, #e9edf3)) calc(l - 0.04) c h); }
& .tmh-pause:active { transform: translateY(1px); }
& .tmh-pause:focus-visible { outline: 3px solid var(--field-focus, var(--accent, #2563eb)); outline-offset: 2px; }
& .tmh-pause[aria-pressed="true"] { background: color-mix(in oklch, var(--accent, #2563eb) 14%, var(--card, #ffffff)); color: var(--ink, #1b2333); }
&.is-paused .tmh-track, &.is-paused .tmh-dash, &.is-paused .tmh-art, &.is-paused .tmh-ring,
&.is-paused .tmh-card img, &.is-paused .tmh-x-ink, &.is-paused .tmh-btn::after, &.is-paused .tmh-stops::before {
animation-play-state: paused;
}
@container (max-width: 1100px) {
& .tmh-map { grid-template-columns: minmax(0, 1fr) 340px; }
& .tmh-card { width: 134px; }
& .tmh-card img { width: 86px; height: 86px; }
& .tmh-cta, & .tmh-ledger, & .tmh-reasons { padding-left: 26px; padding-right: 26px; }
}
@container (max-width: 900px) {
& .tmh-map {
grid-template-columns: minmax(0, 1fr);
grid-template-rows: auto;
grid-template-areas: "cta" "route" "ledger" "reasons" "ticker";
}
& .tmh-cta { padding: 22px 18px 18px; }
& .tmh-route { min-height: 0; padding: 10px 16px 22px; background-size: 56px 56px; }
& .tmh-svg { display: none; }
& .tmh-x { left: 16px; top: 8px; width: 40px; height: 40px; margin-left: 0; transform: none; }
& .tmh-stops { position: relative; inset: auto; display: flex; flex-direction: column-reverse; gap: 14px; margin-top: 60px; }
& .tmh-stops::before {
content: "";
position: absolute;
left: 18.5px;
top: -16px;
bottom: 22px;
width: 3px;
border-radius: 2px;
background: repeating-linear-gradient(to bottom, var(--tmh-route) 0 9px, transparent 9px 18px);
animation: tmh-march-v 1.2s linear infinite;
}
& .tmh-stop {
position: relative;
left: auto;
top: auto;
width: auto;
height: auto;
display: grid;
grid-template-columns: 40px minmax(0, 1fr);
align-items: center;
gap: 10px;
}
& .tmh-pin { position: relative; left: auto; top: auto; transform: none; justify-self: center; }
& .tmh-card {
position: static;
width: auto;
display: grid;
grid-template-columns: 76px minmax(0, 1fr);
justify-items: stretch;
align-items: center;
gap: 14px;
}
& .tmh-card img { width: 76px; height: 76px; }
& .tmh-cap { text-align: left; }
& .tmh-start { min-height: 44px; }
& .tmh-start-pin { position: relative; left: auto; top: auto; transform: none; justify-self: center; grid-column: 1; }
& .tmh-ring { left: 20px; top: 50%; }
& .tmh-start-label { position: static; justify-self: start; grid-column: 2; }
& .tmh-ledger { padding: 20px 18px 8px; }
& .tmh-reasons { padding: 16px 18px 26px; }
}
@container (max-width: 480px) {
& .tmh-lead { margin-top: 1.1rem; }
& .tmh-today { gap: 10px; }
& .tmh-price { font-size: 2.4rem; }
}
@keyframes tmh-ink { from { background-size: 0% 100%; } }
@keyframes tmh-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes tmh-march { to { stroke-dashoffset: -18; } }
@keyframes tmh-march-v { from { background-position: 0 18px; } to { background-position: 0 0; } }
@keyframes tmh-pin-in { from { scale: 0; } }
@keyframes tmh-pop { from { opacity: 0; transform: translateY(10px) scale(0.94); } }
@keyframes tmh-float { from { translate: 0 0; } to { translate: 0 -5px; } }
@keyframes tmh-ring { from { scale: 0.45; opacity: 0.85; } to { scale: 1.5; opacity: 0; } }
@keyframes tmh-x-in { from { scale: 0.2; rotate: -30deg; opacity: 0; } }
@keyframes tmh-x-pulse { 0%, 100% { scale: 1; } 50% { scale: 1.08; } }
@keyframes tmh-glint { 0% { transform: translateX(-120%); } 24%, 100% { transform: translateX(120%); } }
@keyframes tmh-marquee { to { transform: translateX(-50%); } }
@keyframes tmh-drift { from { translate: 0 0; scale: 1; } to { translate: -2% 1.5%; scale: 1.03; } }
@media (prefers-reduced-motion: reduce) {
& *, & *::before, & *::after { animation: none !important; transition: none !important; }
& .tmh-svg { clip-path: none; }
& .tmh-ticker-view { -webkit-mask-image: none; mask-image: none; }
& .tmh-track { width: auto; }
& .tmh-group { width: 100%; flex-wrap: wrap; justify-content: center; row-gap: 8px; padding: 6px 14px; }
& .tmh-dup, & .tmh-rep, & .tmh-pause { display: none; }
}
`
const CSS = RAW.split("&").join(ROOT)
pieces/attention/treasure-map-hero/specimen.tsx 42 lines
import __studioImage518e6d4a from "../assets/9f780bf4fe436389.webp";
import defaults from "../../studio-defaults.json"
import { slot } from "../../slots"
import { TreasureMapHero } from "../treasure-map-hero"
export const states = ["default", "hover", "active", "disabled"] as const
type SpecimenState = (typeof states)[number]
const sample = defaults.sample
export default function TreasureMapHeroSpecimen({ state = "default" }: { state?: SpecimenState }) {
return (
<TreasureMapHero
state={state}
headline={sample.headline}
highlight="a clear plan"
lead={sample.lead}
productName={sample.name}
label="Get The Starter Kit"
sublabel={sample.sublabel}
items={sample.items.map((item, i) => ({
name: item.name,
value: item.value,
image: slot(`item-${i + 1}`, item.image),
imageAlt: item.imageAlt,
}))}
regularPrice={sample.regularPrice}
todayLabel={sample.todayLabel}
price={sample.price}
note={sample.note}
reasonsHeading="Three reasons this is {price}"
reasons={[
"Guide, workbook, and checklist in one download.",
"One payment, lifetime access. Yours to keep.",
`Backed by a ${sample.guarantee}.`,
]}
legend={[...sample.items.map((item) => item.name), "Instant download", sample.guarantee]}
mapImage={slot("texture", __studioImage518e6d4a)}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalTreasureMapHero |
string |
|
highlight OptionalTreasureMapHero |
string |
|
lead OptionalTreasureMapHero |
string |
|
productName OptionalTreasureMapHero |
string |
|
label OptionalTreasureMapHero |
string |
|
sublabel OptionalTreasureMapHero |
string |
|
href OptionalTreasureMapHero |
string |
|
onAction OptionalTreasureMapHero |
(event: React.MouseEvent<HTMLElement>) => void |
|
disabled OptionalTreasureMapHero |
boolean |
|
items OptionalTreasureMapHero |
TreasureMapStop[] |
|
startLabel OptionalTreasureMapHero |
string |
|
stopLabel OptionalTreasureMapHero |
string |
|
routeLabel OptionalTreasureMapHero |
string |
|
totalLabel OptionalTreasureMapHero |
string |
|
regularPrice OptionalTreasureMapHero |
string |
|
todayLabel OptionalTreasureMapHero |
string |
|
price OptionalTreasureMapHero |
string |
|
note OptionalTreasureMapHero |
string |
|
reasonsHeading OptionalTreasureMapHero |
string |
|
reasons OptionalTreasureMapHero |
string[] |
|
legend OptionalTreasureMapHero |
string[] |
|
mapImage OptionalTreasureMapHero |
string |
|
pauseLabel OptionalTreasureMapHero |
string |
|
state OptionalTreasureMapHero |
"default" | "hover" | "active" | "disabled" |
|
className OptionalTreasureMapHero |
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-bg--button-2-border--button-2-ink--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.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-*- One image per offer item (item-1, item-2…), shown in stacks and lists.
texture- A subtle background texture.
-
9f780bf4fe436389.webp
image/webp · 669 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB