Referral Rewards 2
Bonus-entry board for a giveaway's "you're entered" page. The entrant's entry count stands as a scoreboard on a dark angled field. Every bonus action the rules allow becomes one small yes with its own button, and the referral link flips to a large view that is easy to type.
Use it in a prompt
Use content/referral-rewards-2 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/content/referral-rewards-2.tsx. - Import it and pass your copy and images (Props tab):
import { ReferralRewards2 } from "@/components/funneldna/content/referral-rewards-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/referral-rewards-2/component.tsx 639 lines
// layout: diagonal-split
// Bonus-entry board for a giveaway's "you're entered" page. The entrant's entry count stands as a scoreboard on a dark angled field. Every bonus action the rules allow becomes one small yes with its own button, and the referral link flips to a large view that is easy to type.
import * as React from "react";
import { AlertCircle, CalendarDays, Check, Copy, FileText, Link2, Lock, Mail, MousePointerClick, Share2, Star, UserPlus } from "lucide-react";
import type { LucideIcon } from "lucide-react";
import { FX_HOST, Texture } from "../fx/fx";
import topo from "../fx/textures/topo";
export type ReferralRewards2Kind = "refer" | "follow" | "share" | "visit" | "subscribe" | "review";
export type ReferralRewards2State = "default" | "hover" | "active" | "success" | "error";
export type ReferralRewards2Action = {
id: string;
/** Picks the tile icon. */
kind?: ReferralRewards2Kind;
title: React.ReactNode;
/** Entries this action adds, exactly as the official rules state. */
value: number | string;
/** Word under the value (falls back to copy.entriesUnit). */
unit?: string;
/** Bold opening phrase of the description. */
leadIn?: React.ReactNode;
text?: React.ReactNode;
/** Button label. */
label: string;
href?: string;
/** false when the rules don't allow this action: the tile greys out and its button is disabled. */
allowed?: boolean;
/** Why the tile is off (falls back to copy.disabledNote). */
disabledNote?: string;
};
export type ReferralRewards2Referral = {
title?: React.ReactNode;
value: number | string;
unit?: string;
leadIn?: React.ReactNode;
text?: React.ReactNode;
/** The entrant's personal referral link; the full link is copied. */
link: string;
allowed?: boolean;
disabledNote?: string;
};
export type ReferralRewards2Copy = {
copyLabel: string;
copiedLabel: string;
copiedAnnounce: string;
copyError: string;
showLarge: string;
showSmall: string;
largeTitle: string;
largeHint: string;
entriesUnit: string;
/** Screen-reader line for the scoreboard; {count} is replaced by the entry count. */
entriesSr: string;
disabledLabel: string;
disabledNote: string;
referTitle: string;
};
export type ReferralRewards2Props = {
headline?: React.ReactNode;
/** Bold opening phrase of the lead paragraph. */
leadIn?: React.ReactNode;
lead?: React.ReactNode;
/** The entrant's current entry count, supplied by the giveaway; never computed here. */
entries?: number | string;
entriesLabel?: string;
/** Prize cut-out (slot: product), transparent background. */
prizeImage?: string;
prizeAlt?: string;
prizeCaption?: React.ReactNode;
/** The referral tile; set allowed: false when the rules don't allow referrals. */
referral?: ReferralRewards2Referral | null;
actions?: ReferralRewards2Action[];
drawDate?: string;
/** {date} is replaced by drawDate. */
drawLabel?: string;
footnote?: React.ReactNode;
rulesHref?: string;
rulesLabel?: string;
copy?: Partial<ReferralRewards2Copy>;
/** Called with the action id when a bonus-action button is used. */
onAction?: (id: string) => void;
/** Called with the link after it is copied. */
onCopy?: (link: string) => void;
state?: ReferralRewards2State;
className?: string;
};
const DEFAULT_COPY: ReferralRewards2Copy = {
copyLabel: "Copy my link",
copiedLabel: "Copied",
copiedAnnounce: "Your referral link is copied.",
copyError: "We couldn't copy it here. Show it large, then tap the link to select it.",
showLarge: "Show it large",
showSmall: "Flip back",
largeTitle: "Your link, big enough to type",
largeHint: "Tap the link to select all of it.",
entriesUnit: "entries",
entriesSr: "{count} entries in the draw so far",
disabledLabel: "Not available",
disabledNote: "Not part of this giveaway's rules.",
referTitle: "Refer a friend",
};
const DEFAULT_REFERRAL: ReferralRewards2Referral = {
title: "Refer a friend",
value: 5,
unit: "per friend",
leadIn: "Your biggest booster.",
text: "Every friend who enters through your link adds bonus entries to your total.",
link: "https://example.com/giveaway?ref=A7K2Q",
};
const DEFAULT_ACTIONS: ReferralRewards2Action[] = [
{ id: "follow", kind: "follow", title: "Follow us", value: 2, leadIn: "Quickest win.", text: "Follow along for new drops and tips.", label: "Follow us" },
{ id: "share", kind: "share", title: "Share the giveaway", value: 3, leadIn: "Ten seconds, tops.", text: "Post the giveaway to your feed or stories.", label: "Share it" },
];
const KIND_ICONS: Record<ReferralRewards2Kind, LucideIcon> = {
refer: Link2,
follow: UserPlus,
share: Share2,
visit: MousePointerClick,
subscribe: Mail,
review: Star,
};
export function ReferralRewards2(props: ReferralRewards2Props) {
const {
headline = "You're entered. Now stack your odds.",
leadIn = "Your entry is locked in.",
lead = "Every bonus action on this board adds entries to the same draw. Pick one to start.",
entries = 1,
entriesLabel = "Your entries",
prizeImage,
prizeAlt = "The giveaway prize",
prizeCaption,
referral = DEFAULT_REFERRAL,
actions = DEFAULT_ACTIONS,
drawDate = "",
drawLabel = "Winner drawn {date}",
footnote,
rulesHref = "",
rulesLabel = "Read the official rules",
copy,
onAction,
onCopy,
state = "default",
className = "",
} = props;
const c: ReferralRewards2Copy = { ...DEFAULT_COPY, ...copy };
const uid = React.useId();
const headId = `${uid}-head`;
const shown = typeof entries === "number" ? new Intl.NumberFormat("en-US").format(entries) : String(entries);
const chars = Array.from(shown);
const hasFoot = Boolean(drawDate || footnote || rulesHref);
const offset = referral ? 1 : 0;
const oddLast = actions.length % 2 === 1;
return (
<section
className={["cf-referral-rewards-2", className].filter(Boolean).join(" ")}
data-state={state}
style={FX_HOST}
aria-labelledby={headId}
>
<style>{CSS}</style>
<Texture src={topo} tone="ink" />
<div className="rr2-inner">
<div className={prizeImage ? "rr2-stage" : "rr2-stage rr2-stage--solo"}>
<h2 id={headId} className="rr2-headline">{headline}</h2>
<div className="rr2-score">
<p className="rr2-score-label">{entriesLabel}</p>
<p className="rr2-digits" style={{ "--rr2-n": Math.max(chars.length, 1) } as React.CSSProperties}>
<span className="rr2-sr">{c.entriesSr.split("{count}").join(shown)}</span>
{chars.map((ch, i) => (
<span key={i} aria-hidden="true" className={isDigit(ch) ? "rr2-digit" : "rr2-sep"}>
{ch}
</span>
))}
</p>
</div>
{leadIn || lead ? (
<p className="rr2-lead">
{leadIn ? <strong>{leadIn}</strong> : null}
{leadIn && lead ? " " : null}
{lead}
</p>
) : null}
{prizeImage ? (
<figure className="rr2-prize">
<img src={prizeImage} alt={prizeAlt} width={512} height={512} decoding="async" />
{prizeCaption ? <figcaption>{prizeCaption}</figcaption> : null}
</figure>
) : null}
</div>
<div className="rr2-board">
<div className="rr2-grid">
{referral ? (
referral.allowed === false ? (
<ActionTile
action={{
id: "refer",
kind: "refer",
title: referral.title ?? c.referTitle,
value: referral.value,
unit: referral.unit,
leadIn: referral.leadIn,
text: referral.text,
label: c.copyLabel,
allowed: false,
disabledNote: referral.disabledNote,
}}
c={c}
wide
index={0}
/>
) : (
<ReferralTile referral={referral} c={c} onCopy={onCopy} forced={state} index={0} />
)
) : null}
{actions.map((action, i) => (
<ActionTile
key={action.id}
action={action}
c={c}
onAction={onAction}
wide={oddLast && i === actions.length - 1}
index={i + offset}
/>
))}
{hasFoot ? (
<div className="rr2-cell rr2-cell--wide" style={{ "--rr2-i": actions.length + offset } as React.CSSProperties}>
<div className="rr2-tile rr2-foot">
{drawDate ? (
<span className="rr2-disc" aria-hidden="true">
<CalendarDays size={20} strokeWidth={2.5} />
</span>
) : null}
<div className="rr2-foot-text">
{drawDate ? <p className="rr2-foot-title">{drawLabel.split("{date}").join(drawDate)}</p> : null}
{footnote ? <p className="rr2-foot-note">{footnote}</p> : null}
</div>
{rulesHref ? (
<a className="rr2-rules" href={rulesHref}>
<FileText size={16} strokeWidth={2.5} aria-hidden="true" />
{rulesLabel}
</a>
) : null}
</div>
</div>
) : null}
</div>
</div>
</div>
</section>
);
}
export default ReferralRewards2;
type CopyStatus = "idle" | "copied" | "error";
function ReferralTile({
referral,
c,
onCopy,
forced,
index,
}: {
referral: ReferralRewards2Referral;
c: ReferralRewards2Copy;
onCopy?: (link: string) => void;
forced: ReferralRewards2State;
index: number;
}) {
const [flipped, setFlipped] = React.useState(false);
const [status, setStatus] = React.useState<CopyStatus>(() => statusFor(forced));
const timer = React.useRef<number | undefined>(undefined);
const frontToggle = React.useRef<HTMLButtonElement>(null);
const backToggle = React.useRef<HTMLButtonElement>(null);
const toggled = React.useRef(false);
React.useEffect(() => {
setStatus(statusFor(forced));
}, [forced]);
React.useEffect(() => () => window.clearTimeout(timer.current), []);
React.useEffect(() => {
if (!toggled.current) return;
const target = flipped ? backToggle.current : frontToggle.current;
target?.focus({ preventScroll: true });
}, [flipped]);
const toggle = () => {
toggled.current = true;
setFlipped((f) => !f);
};
async function copyLink(event: React.MouseEvent<HTMLButtonElement>) {
const button = event.currentTarget;
let ok = false;
try {
if (typeof navigator !== "undefined" && navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(referral.link);
ok = true;
}
} catch {
ok = false;
}
if (!ok) ok = legacyCopy(referral.link, button);
window.clearTimeout(timer.current);
if (ok) {
setStatus("copied");
onCopy?.(referral.link);
timer.current = window.setTimeout(() => setStatus("idle"), 2400);
} else {
setStatus("error");
}
}
const copied = status === "copied";
const display = stripProtocol(referral.link);
const parts = splitCode(display);
const unit = referral.unit ?? c.entriesUnit;
const copyButton = (
<button type="button" className={copied ? "rr2-btn rr2-btn--primary is-copied" : "rr2-btn rr2-btn--primary"} onClick={copyLink}>
{copied ? <Check size={20} strokeWidth={2.5} aria-hidden="true" /> : <Copy size={20} strokeWidth={2.5} aria-hidden="true" />}
<span>{copied ? c.copiedLabel : c.copyLabel}</span>
</button>
);
const error =
status === "error" ? (
<p className="rr2-error">
<AlertCircle size={16} strokeWidth={2.5} aria-hidden="true" />
{c.copyError}
</p>
) : null;
return (
<div
className={flipped ? "rr2-cell rr2-cell--wide rr2-flip is-flipped" : "rr2-cell rr2-cell--wide rr2-flip"}
style={{ "--rr2-i": index } as React.CSSProperties}
>
<div className="rr2-flipper">
<article className="rr2-tile rr2-tile--feat rr2-face rr2-face--front" aria-hidden={flipped ? true : undefined}>
<TileTop Icon={Link2} value={referral.value} unit={unit} />
<h3 className="rr2-title">{referral.title ?? c.referTitle}</h3>
<Desc leadIn={referral.leadIn} text={referral.text} />
<p className="rr2-well" title={referral.link}>{display}</p>
<div className="rr2-actions">
{copyButton}
<button ref={frontToggle} type="button" className="rr2-btn rr2-btn--secondary" onClick={toggle}>
<span>{c.showLarge}</span>
</button>
</div>
{error}
</article>
<div className="rr2-tile rr2-tile--feat rr2-face rr2-face--back" aria-hidden={flipped ? undefined : true}>
<p className="rr2-back-title">{c.largeTitle}</p>
<p className="rr2-hint">{c.largeHint}</p>
<p className="rr2-biglink">
{withBreaks(parts.base)}
{parts.code ? <span className="rr2-code">{parts.code}</span> : null}
</p>
<div className="rr2-actions">
{copyButton}
<button ref={backToggle} type="button" className="rr2-btn rr2-btn--secondary" onClick={toggle}>
<span>{c.showSmall}</span>
</button>
</div>
{error}
</div>
</div>
<p className="rr2-sr" role="status" aria-live="polite">
{copied ? c.copiedAnnounce : status === "error" ? c.copyError : ""}
</p>
</div>
);
}
function ActionTile({
action,
c,
onAction,
wide,
index,
}: {
action: ReferralRewards2Action;
c: ReferralRewards2Copy;
onAction?: (id: string) => void;
wide?: boolean;
index: number;
}) {
const allowed = action.allowed !== false;
const Icon = KIND_ICONS[action.kind ?? "visit"] ?? MousePointerClick;
return (
<div className={wide ? "rr2-cell rr2-cell--wide" : "rr2-cell"} style={{ "--rr2-i": index } as React.CSSProperties}>
<article className={allowed ? "rr2-tile" : "rr2-tile rr2-tile--off"}>
<TileTop Icon={Icon} value={action.value} unit={action.unit ?? c.entriesUnit} />
<h3 className="rr2-title">{action.title}</h3>
<Desc leadIn={action.leadIn} text={action.text} />
{allowed ? null : <p className="rr2-note">{action.disabledNote ?? c.disabledNote}</p>}
<div className="rr2-actions">
{!allowed ? (
<button type="button" className="rr2-btn rr2-btn--off" disabled>
<Lock size={20} strokeWidth={2.5} aria-hidden="true" />
<span>{c.disabledLabel}</span>
</button>
) : action.href ? (
<a className="rr2-btn rr2-btn--primary" href={action.href} onClick={() => onAction?.(action.id)}>
<span>{action.label}</span>
</a>
) : (
<button type="button" className="rr2-btn rr2-btn--primary" onClick={() => onAction?.(action.id)}>
<span>{action.label}</span>
</button>
)}
</div>
</article>
</div>
);
}
function TileTop({ Icon, value, unit }: { Icon: LucideIcon; value: number | string; unit: string }) {
return (
<div className="rr2-top">
<span className="rr2-disc" aria-hidden="true">
<Icon size={20} strokeWidth={2.5} />
</span>
<p className="rr2-value">
<span className="rr2-value-num">{plus(value)}</span>
<span className="rr2-value-unit">{unit}</span>
</p>
</div>
);
}
function Desc({ leadIn, text }: { leadIn?: React.ReactNode; text?: React.ReactNode }) {
if (!leadIn && !text) return null;
return (
<p className="rr2-desc">
{leadIn ? <strong>{leadIn}</strong> : null}
{leadIn && text ? " " : null}
{text}
</p>
);
}
function statusFor(state: ReferralRewards2State): CopyStatus {
if (state === "success") return "copied";
if (state === "error") return "error";
return "idle";
}
function isDigit(ch: string) {
return ch >= "0" && ch <= "9";
}
function plus(value: number | string) {
const s = String(value).trim();
return s.startsWith("+") ? s : `+${s}`;
}
function stripProtocol(link: string) {
const i = link.indexOf("://");
return i >= 0 ? link.slice(i + 3) : link;
}
function splitCode(display: string) {
const cut = Math.max(display.lastIndexOf("="), display.lastIndexOf("/"));
if (cut < 0 || cut === display.length - 1) return { base: display, code: "" };
return { base: display.slice(0, cut + 1), code: display.slice(cut + 1) };
}
function withBreaks(text: string) {
const out: React.ReactNode[] = [];
let buffer = "";
for (const ch of Array.from(text)) {
buffer += ch;
if (ch === "/" || ch === "?" || ch === "&" || ch === "=") {
out.push(
<React.Fragment key={out.length}>
{buffer}
<wbr />
</React.Fragment>,
);
buffer = "";
}
}
if (buffer) out.push(<React.Fragment key={out.length}>{buffer}</React.Fragment>);
return out;
}
function legacyCopy(text: string, restore: HTMLElement | null): boolean {
if (typeof document === "undefined") return false;
const area = document.createElement("textarea");
area.value = text;
area.setAttribute("readonly", "");
area.style.position = "fixed";
area.style.top = "0";
area.style.left = "0";
area.style.opacity = "0";
document.body.appendChild(area);
area.select();
let ok = false;
try {
ok = document.execCommand("copy");
} catch {
ok = false;
}
document.body.removeChild(area);
restore?.focus({ preventScroll: true });
return ok;
}
const R = ".cf-referral-rewards-2";
const CSS = `
${R}{
--rr2-pt:clamp(56px,8vw,112px);
--rr2-pb:clamp(64px,8.5vw,120px);
--rr2-gut:clamp(16px,5vw,48px);
--rr2-gap:clamp(64px,6.5vw,96px);
--rr2-sh:var(--shadow,oklch(0.22 0.03 260));
position:relative;
overflow:hidden;
background:var(--surface,#ffffff);
color:var(--ink,#101828);
font-family:var(--font-body);
padding:var(--rr2-pt) var(--rr2-gut) var(--rr2-pb);
}
${R} *,${R} *::before,${R} *::after{box-sizing:border-box}
${R} .rr2-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
${R} .rr2-inner{position:relative;z-index:1;max-width:1120px;margin:0 auto;display:grid;grid-template-columns:minmax(0,1fr);row-gap:88px}
${R} .rr2-stage{position:relative;isolation:isolate;min-width:0;margin-inline:calc(-1 * var(--rr2-gut));padding-inline:var(--rr2-gut);background:var(--band,#1b2a4a);color:var(--band-ink,#ffffff);display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);grid-template-areas:"head head" "score prize" "lead lead";column-gap:16px;align-content:start}
${R} .rr2-stage--solo{grid-template-columns:minmax(0,1fr);grid-template-areas:"head" "score" "lead"}
${R} .rr2-stage::before{content:"";position:absolute;z-index:-1;top:calc(-1 * var(--rr2-pt));bottom:-56px;left:0;right:0;background:var(--band,#1b2a4a);clip-path:polygon(0 0,100% 0,100% calc(100% - 56px),0 100%)}
${R} .rr2-headline{grid-area:head;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}
${R} .rr2-score{grid-area:score;container-type:inline-size;margin-top:24px;min-width:0}
${R} .rr2-score-label{margin:0 0 12px;font-size:.875rem;font-weight:800;line-height:1.2;letter-spacing:.08em;text-transform:uppercase}
${R} .rr2-digits{display:flex;flex-wrap:nowrap;align-items:flex-end;gap:.06em;margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(4.5rem,8.5vw,7.5rem);font-size:min(clamp(4.5rem,8.5vw,7.5rem),calc(100cqi / (var(--rr2-n) * .82)));line-height:1;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
${R} .rr2-digit{position:relative;display:inline-flex;justify-content:center;min-width:.74em;padding:.08em .1em .06em;border-radius:10px;background:oklch(from var(--band-ink,#ffffff) l c h / .1);box-shadow:inset 0 1px 0 oklch(from var(--band-ink,#ffffff) l c h / .16),inset 0 -3px 0 oklch(from var(--band,#1b2a4a) calc(l - .08) c h / .7)}
${R} .rr2-digit::after{content:"";position:absolute;left:0;right:0;top:50%;height:2px;margin-top:-1px;background:oklch(from var(--band,#1b2a4a) calc(l - .06) c h / .85)}
${R} .rr2-sep{padding-bottom:.06em}
${R} .rr2-lead{grid-area:lead;margin:24px 0 0;max-width:46ch;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
${R} .rr2-lead strong{font-weight:800}
${R} .rr2-prize{grid-area:prize;align-self:end;margin:24px 0 0;min-width:0}
${R} .rr2-prize img{display:block;width:100%;height:auto;aspect-ratio:1;max-height:220px;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 2px 3px oklch(from var(--rr2-sh) calc(l - .06) c h / .5)) drop-shadow(0 14px 16px oklch(from var(--rr2-sh) l c h / .45))}
${R} .rr2-prize figcaption{margin-top:8px;font-size:.9375rem;font-weight:600;line-height:1.4;text-align:center;text-wrap:pretty}
@media (min-width:900px){
${R} .rr2-inner{grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);column-gap:var(--rr2-gap);row-gap:0}
${R} .rr2-stage,${R} .rr2-stage--solo{grid-template-columns:minmax(0,1fr);grid-template-areas:"head" "score" "lead" "prize";margin-right:0;padding-right:16px}
${R} .rr2-stage::before{bottom:calc(-1 * var(--rr2-pb));left:-100vw;right:calc(var(--rr2-gap) * -.5 - 18px);clip-path:polygon(0 0,100% 0,calc(100% - 60px) 100%,0 100%)}
${R} .rr2-score{margin-top:32px}
${R} .rr2-prize{align-self:start;margin-top:32px}
${R} .rr2-prize img{width:auto;max-width:100%;height:clamp(220px,22vw,300px);max-height:none;aspect-ratio:auto;object-position:left bottom}
${R} .rr2-prize figcaption{text-align:left}
}
${R} .rr2-board{position:relative;min-width:0;container-type:inline-size;container-name:rr2board}
${R} .rr2-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:16px}
@container rr2board (min-width:500px){
${R} .rr2-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
${R} .rr2-cell--wide{grid-column:1 / -1}
}
${R} .rr2-cell{display:flex;min-width:0;animation:cf-rr2-in .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:min(calc(var(--rr2-i,0) * .07s),.28s)}
${R} .rr2-cell > .rr2-tile{flex:1 1 auto}
@keyframes cf-rr2-in{from{opacity:.82;transform:translateY(8px)}}
${R} .rr2-tile{position:relative;display:flex;flex-direction:column;min-width:0;background:var(--card,#ffffff);color:var(--ink,#101828);border:1px solid var(--card-border,oklch(from var(--ink,#101828) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / .22),0 4px 10px -2px oklch(0.22 0.03 260 / .2)));padding:clamp(20px,3vw,28px)}
${R} .rr2-tile--feat{border-color:oklch(from var(--accent,#2563eb) l c h / .45);box-shadow:var(--shadow-lg,0 2px 4px oklch(0.22 0.03 260 / .22),0 12px 24px -8px oklch(0.22 0.03 260 / .32))}
${R} .rr2-tile--off{background:color-mix(in oklch,var(--ink,#101828) 4%,var(--card,#ffffff));box-shadow:none}
${R} .rr2-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
${R} .rr2-disc{flex:none;display:grid;place-items:center;width:40px;height:40px;border-radius:999px;background:var(--accent-fill,var(--accent,#2563eb));color:var(--accent-fill-ink,var(--card,#ffffff))}
${R} .rr2-tile--off .rr2-disc{background:var(--secondary,#e8ebf1);color:var(--secondary-ink,#101828)}
${R} .rr2-value{display:flex;flex-direction:column;align-items:flex-end;margin:0;text-align:right}
${R} .rr2-value-num{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1;letter-spacing:-.03em;font-variant-numeric:tabular-nums;color:var(--accent,#2563eb)}
${R} .rr2-value-unit{margin-top:6px;font-size:.875rem;font-weight:800;line-height:1.2;letter-spacing:.06em;text-transform:uppercase;color:var(--muted,#4a5565)}
${R} .rr2-tile--off .rr2-value-num{color:var(--muted,#4a5565)}
${R} .rr2-title{margin:16px 0 0;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;text-wrap:balance}
${R} .rr2-desc{margin:8px 0 0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
${R} .rr2-desc strong{font-weight:800}
${R} .rr2-note{margin:8px 0 0;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted,#4a5565);text-wrap:pretty}
${R} .rr2-well{margin:16px 0 0;padding:12px 16px;border-radius:10px;background:color-mix(in oklch,var(--ink,#101828) 5%,var(--card,#ffffff));font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:600;line-height:1.4;overflow-wrap:anywhere}
${R} .rr2-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:auto;padding-top:20px}
${R} .rr2-actions > .rr2-btn{flex:1 1 11rem}
${R} .rr2-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:56px;padding:0 24px;border:0;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:1.125rem;line-height:1.15;white-space:nowrap;text-decoration:none;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
${R} .rr2-btn svg{flex:none}
${R} .rr2-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent,#2563eb));outline-offset:3px}
${R} .rr2-btn--primary{color:var(--button-ink,var(--cta-ink,#ffffff));text-shadow:var(--button-text-shadow,none);background:linear-gradient(180deg,oklch(from var(--button-bg,var(--cta,#d92d20)) calc(l + .04) c h),oklch(from var(--button-bg-2,var(--cta-2,#b42318)) calc(l - .02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta,#d92d20)) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta,#d92d20)) calc(l - .16) c h),0 1px 2px oklch(from var(--rr2-sh) l c h / .3),0 8px 16px -6px oklch(from var(--rr2-sh) l c h / .45))}
${R} .rr2-btn--primary:hover,${R}[data-state="hover"] .rr2-btn--primary{background:linear-gradient(180deg,oklch(from var(--button-bg,var(--cta,#d92d20)) calc(l - .01) c h),oklch(from var(--button-bg-2,var(--cta-2,#b42318)) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta,#d92d20)) calc(l + .1) c h / .6),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta,#d92d20)) calc(l - .2) c h),0 1px 2px oklch(from var(--rr2-sh) l c h / .35),0 10px 18px -6px oklch(from var(--rr2-sh) l c h / .55))}
${R} .rr2-btn--primary:active,${R}[data-state="active"] .rr2-btn--primary{transform:translateY(1px);background:linear-gradient(180deg,oklch(from var(--button-bg,var(--cta,#d92d20)) calc(l - .05) c h),oklch(from var(--button-bg-2,var(--cta-2,#b42318)) calc(l - .09) c h));box-shadow:inset 0 2px 4px oklch(from var(--button-bg,var(--cta,#d92d20)) calc(l - .24) c h / .55),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta,#d92d20)) calc(l - .16) c h),0 1px 1px oklch(from var(--rr2-sh) l c h / .3)}
${R} .rr2-btn--secondary{color:var(--button-2-ink,var(--secondary-ink,#101828));background:var(--button-2-bg,var(--secondary,#e8ebf1));border:1px solid var(--button-2-border,transparent);box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 1px oklch(0.22 0.03 260 / .18),0 1px 3px oklch(0.22 0.03 260 / .14)))}
${R} .rr2-btn--secondary:hover,${R}[data-state="hover"] .rr2-btn--secondary{background:oklch(from var(--button-2-bg,var(--secondary,#e8ebf1)) calc(l - .035) c h)}
${R} .rr2-btn--secondary:active,${R}[data-state="active"] .rr2-btn--secondary{transform:translateY(1px);background:oklch(from var(--button-2-bg,var(--secondary,#e8ebf1)) calc(l - .06) c h);box-shadow:none}
${R} .rr2-btn--off{color:var(--secondary-ink,#101828);background:var(--secondary,#e8ebf1);box-shadow:none;cursor:not-allowed}
${R} .rr2-flip{perspective:1600px}
${R} .rr2-flipper{display:grid;flex:1 1 auto;min-width:0;transform-style:preserve-3d;transition:transform .55s cubic-bezier(.2,.7,.2,1)}
${R} .rr2-flip.is-flipped .rr2-flipper{transform:rotateY(180deg)}
${R} .rr2-face{grid-area:1 / 1;-webkit-backface-visibility:hidden;backface-visibility:hidden;visibility:visible;transition:visibility 0s linear 0s}
${R} .rr2-face--back{transform:rotateY(180deg)}
${R} .rr2-face[aria-hidden="true"]{visibility:hidden;pointer-events:none;transition:visibility 0s linear .28s}
${R} .rr2-back-title{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;text-wrap:balance}
${R} .rr2-hint{margin:8px 0 0;font-size:.9375rem;font-weight:500;line-height:1.4;color:var(--muted,#4a5565)}
${R} .rr2-biglink{margin:16px 0 0;padding:16px 20px;border-radius:10px;background:color-mix(in oklch,var(--ink,#101828) 5%,var(--card,#ffffff));font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.5rem,2.4vw,2rem);line-height:1.25;letter-spacing:.005em;overflow-wrap:anywhere;-webkit-user-select:all;user-select:all;cursor:text}
${R} .rr2-code{color:var(--accent,#2563eb)}
${R} .rr2-error{margin:12px 0 0;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--danger,#b42318);text-wrap:pretty}
${R} .rr2-error svg{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em}
${R} .rr2-tile.rr2-foot{flex-direction:row;flex-wrap:wrap;align-items:center;gap:12px 16px}
${R} .rr2-foot-text{flex:1 1 14rem;min-width:0}
${R} .rr2-foot-title{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;text-wrap:balance}
${R} .rr2-foot-note{margin:4px 0 0;font-size:.9375rem;font-weight:500;line-height:1.4;color:var(--muted,#4a5565);text-wrap:pretty}
${R} .rr2-rules{flex:none;font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:700;line-height:1.4;white-space:nowrap;color:var(--link,var(--accent,#2563eb));text-decoration:underline;text-decoration-color:oklch(from var(--link,var(--accent,#2563eb)) l c h / .45);text-underline-offset:.18em}
${R} .rr2-rules:hover{color:oklch(from var(--link,var(--accent,#2563eb)) calc(l - .08) c h);text-decoration-color:currentColor}
${R} .rr2-rules:focus-visible{outline:3px solid var(--field-focus,var(--accent,#2563eb));outline-offset:3px;border-radius:4px}
${R} .rr2-rules svg{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em}
@media (prefers-reduced-motion:reduce){
${R} .rr2-cell{animation:none}
${R} .rr2-btn{transition:none}
${R} .rr2-flipper{transition:none}
${R} .rr2-flip.is-flipped .rr2-flipper{transform:none}
${R} .rr2-face--back{transform:none}
${R} .rr2-face,${R} .rr2-face[aria-hidden="true"]{transition:none}
}
`;
pieces/content/referral-rewards-2/specimen.tsx 61 lines
import __studioImage8e28e02c from "../assets/93fc6c1591a1c825.webp";
import { ReferralRewards2 } from "../referral-rewards-2";
import { slot } from "../../slots";
export const states = ["default", "hover", "active", "disabled", "success", "error"];
type SpecimenState = "default" | "hover" | "active" | "disabled" | "success" | "error";
export default function ReferralRewards2Specimen({ state = "default" }: { state?: SpecimenState }) {
const pieceState = state === "disabled" ? "default" : state;
return (
<ReferralRewards2
state={pieceState}
headline="You're entered. Now stack your odds."
leadIn="Your entry is locked in."
lead="Every bonus action on this board adds entries to the same draw. Pick one to start."
entries={3}
entriesLabel="Your entries"
prizeImage={slot(
"product",
__studioImage8e28e02c,
)}
prizeAlt="Trailhead Outfitters Basecamp Kit: backpack, sleeping bag, camp stove, water bottle and trekking poles"
prizeCaption="Grand prize: the Trailhead Outfitters Basecamp Kit"
referral={{
title: "Refer a friend",
value: 5,
unit: "per friend",
leadIn: "Your biggest booster.",
text: "Every friend who enters through your link adds 5 entries to your total.",
link: "https://trailheadoutfitters.com/giveaway?ref=MAYA-7K2Q",
}}
actions={[
{
id: "follow",
kind: "follow",
title: "Follow Trailhead Outfitters",
value: 2,
leadIn: "Quickest win.",
text: "Follow us for trail tips and new gear drops.",
label: "Follow us",
},
{
id: "share",
kind: "share",
title: "Share the giveaway",
value: 3,
leadIn: "Ten seconds, tops.",
text: "Post the giveaway to your feed or your stories.",
label: "Share it",
allowed: state !== "disabled",
disabledNote: "Sharing isn't part of this giveaway's rules.",
},
]}
drawDate="December 15, 2026"
footnote="No purchase necessary. Open to legal US residents 18 and older."
rulesHref="#official-rules"
rulesLabel="Read the official rules"
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalReferralRewards2 |
React.ReactNode |
|
leadIn OptionalReferralRewards2 |
React.ReactNode |
|
lead OptionalReferralRewards2 |
React.ReactNode |
|
entries OptionalReferralRewards2 |
number | string |
|
entriesLabel OptionalReferralRewards2 |
string |
|
prizeImage OptionalReferralRewards2 |
string |
|
prizeAlt OptionalReferralRewards2 |
string |
|
prizeCaption OptionalReferralRewards2 |
React.ReactNode |
|
referral OptionalReferralRewards2 |
ReferralRewards2Referral | null |
|
actions OptionalReferralRewards2 |
ReferralRewards2Action[] |
|
drawDate OptionalReferralRewards2 |
string |
|
drawLabel OptionalReferralRewards2 |
string |
|
footnote OptionalReferralRewards2 |
React.ReactNode |
|
rulesHref OptionalReferralRewards2 |
string |
|
rulesLabel OptionalReferralRewards2 |
string |
|
copy OptionalReferralRewards2 |
Partial<ReferralRewards2Copy> |
|
onAction OptionalReferralRewards2 |
(id: string) => void |
|
onCopy OptionalReferralRewards2 |
(link: string) => void |
|
state OptionalReferralRewards2 |
ReferralRewards2State |
|
className OptionalReferralRewards2 |
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.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
product- The main product shot or cover (ebook, kit, bottle).
-
93fc6c1591a1c825.webp
image/webp · 266 KB
-
a57ca5c86a05001f.webp
image/webp · 108 KB