Referral Share 3
Refer-a-friend: three stacked panels move from the reward, to the next reward tier, to copying and sending the link.
Use it in a prompt
Use checkout/referral-share-3 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/checkout/referral-share-3.tsx. - Import it and pass your copy and images (Props tab):
import { ReferralShare3 } from "@/components/funneldna/checkout/referral-share-3"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/referral-share-3/component.tsx 592 lines
// layout: scroll-panels
// Refer-a-friend: three stacked panels move from the reward, to the next reward tier, to copying and sending the link.
import * as React from "react"
import { Check, CircleAlert, Copy, Gift, Link2, Mail, MessageSquare, ShieldCheck } from "lucide-react"
export type ReferralShare3Channel = "email" | "sms" | "facebook" | "x" | "linkedin"
export type ReferralShare3Tier = {
/** Friends who must buy to unlock this tier. */
count: number
/** The supplied reward for reaching it, e.g. "$30 back". */
reward: string
}
export type ReferralShare3Copy = {
/** Panel 1 headline; {reward} is replaced with the reward. */
headline: string
/** Line under the big reward figure. */
rewardCaption: string
/** Shown only when friendReward is set; {friendReward} is replaced. */
friendLine: string
/** Small-caps label before investmentPrice. */
investmentLabel: string
/** {count} friends left, {reward} of the next tier. */
progressOne: string
progressMany: string
/** All tiers reached; {reward} is the per-friend reward. */
progressDone: string
noteZero: string
/** {count} is the number of friends who bought. */
noteOne: string
noteMany: string
/** Tier count label; {count} is replaced. */
tierOne: string
tierMany: string
/** Screen-reader status for each tier. */
tierDone: string
tierNext: string
tierLocked: string
progressLabel: string
actionLine: string
linkLabel: string
linkPlaceholder: string
copyLabel: string
copiedLabel: string
copiedAnnounce: string
copyError: string
shareLead: string
/** Email subject for the email share. */
shareSubject: string
channels: Record<ReferralShare3Channel, string>
}
export type ReferralShare3Props = {
/** The supplied reward per referral, short, e.g. "$10". */
reward: string
/** What the friend gets, e.g. "$10"; hides the friend line when empty. */
friendReward?: string
/** What the friend pays with the link, e.g. "$37"; shown as the investment line. */
investmentPrice?: string
/** Friends who have bought with this link so far. */
referrals?: number
/** Supplied reward tiers; the tracker panel hides when empty. */
tiers?: ReferralShare3Tier[]
/** The visitor's personal referral link. */
link: string
/** Prefilled message for email, text and social shares. */
shareText?: string
channels?: ReferralShare3Channel[]
/** Optional terms line under the share buttons. */
note?: React.ReactNode
copy?: Partial<Omit<ReferralShare3Copy, "channels">> & {
channels?: Partial<Record<ReferralShare3Channel, string>>
}
/** Called after the link is copied. */
onCopy?: (link: string) => void
/** Called when a share button is clicked, before it opens. */
onShare?: (channel: ReferralShare3Channel, href: string) => void
disabled?: boolean
state?: "default" | "hover" | "active" | "disabled" | "error" | "success"
className?: string
}
export function ReferralShare3(props: ReferralShare3Props) {
const {
reward,
friendReward,
investmentPrice,
referrals = 0,
tiers = [],
link,
shareText = "Thought of you when I got this. Here's my link:",
channels = ["email", "sms", "facebook", "x", "linkedin"],
note,
onCopy,
onShare,
state = "default",
className,
} = props
const copy: ReferralShare3Copy = {
...DEFAULT_COPY,
...(props.copy || {}),
channels: { ...DEFAULT_COPY.channels, ...((props.copy && props.copy.channels) || {}) },
}
const disabled = Boolean(props.disabled) || state === "disabled"
const uid = React.useId().replace(/:/g, "")
const headId = `rs${uid}-head`
const inputId = `rs${uid}-link`
const errorId = `rs${uid}-error`
const inputRef = React.useRef<HTMLInputElement>(null)
const timer = React.useRef<number | null>(null)
const [status, setStatus] = React.useState<"idle" | "copied" | "error">("idle")
const rootRef = React.useRef<HTMLElement>(null)
// "static" renders the finished look (no JS, reduced motion); "armed" waits offscreen; "in" plays once.
const [motion, setMotion] = React.useState<"static" | "armed" | "in">("static")
useIsoLayoutEffect(() => {
const el = rootRef.current
if (!el || typeof IntersectionObserver === "undefined") return
if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return
setMotion("armed")
const io = new IntersectionObserver(
(entries) => {
if (entries.some((e) => e.isIntersecting)) {
setMotion("in")
io.disconnect()
}
},
{ threshold: 0.15 },
)
io.observe(el)
return () => io.disconnect()
}, [])
React.useEffect(() => {
return () => {
if (timer.current !== null) window.clearTimeout(timer.current)
}
}, [])
const shown = disabled ? "idle" : state === "error" ? "error" : state === "success" ? "copied" : status
async function handleCopy() {
if (disabled) return
let ok = false
try {
if (typeof navigator !== "undefined" && navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(link)
ok = true
}
} catch {
ok = false
}
if (!ok && inputRef.current) {
inputRef.current.focus()
inputRef.current.select()
try {
ok = document.execCommand("copy")
} catch {
ok = false
}
}
if (timer.current !== null) window.clearTimeout(timer.current)
if (ok) {
setStatus("copied")
if (onCopy) onCopy(link)
timer.current = window.setTimeout(() => setStatus("idle"), 2400)
} else {
setStatus("error")
}
}
const sorted = tiers.filter((t) => t.count > 0).slice().sort((a, b) => a.count - b.count)
const n = sorted.length
const next = sorted.find((t) => t.count > referrals)
const remaining = next ? next.count - referrals : 0
const progressLine = next
? fill(remaining === 1 ? copy.progressOne : copy.progressMany, { count: remaining, reward: next.reward })
: fill(copy.progressDone, { reward })
const progressNote = fill(
referrals <= 0 ? copy.noteZero : referrals === 1 ? copy.noteOne : copy.noteMany,
{ count: referrals },
)
const max = n ? sorted[n - 1].count : 0
const trackEnd = n ? ((n - 0.5) / n) * 100 : 0
const fillPos = progressPosition(referrals, sorted)
const trackerStyle = {
["--rs-n" as string]: String(n),
["--rs-track" as string]: `${trackEnd}%`,
["--rs-fill" as string]: `${fillPos}%`,
} as React.CSSProperties
const copyClass = [
"cf-rs-copy",
state === "hover" ? "is-hover" : "",
state === "active" ? "is-active" : "",
shown === "copied" ? "is-copied" : "",
]
.filter(Boolean)
.join(" ")
return (
<section
ref={rootRef}
className={["cf-rs", className].filter(Boolean).join(" ")}
aria-labelledby={headId}
data-motion={motion === "static" ? undefined : motion}
>
<style>{STYLES}</style>
<div className="cf-rs-hook">
<div className="cf-rs-hook-copy">
<h2 className="cf-rs-h2" id={headId}>
{fill(copy.headline, { reward })}
</h2>
{friendReward ? (
<p className="cf-rs-friend">
{fill(copy.friendLine, { friendReward })}
{investmentPrice ? (
<>
{" "}
<span className="cf-rs-invest">
<span className="cf-rs-invest-label">{copy.investmentLabel}</span>{" "}
<strong>{investmentPrice}</strong>
</span>
</>
) : null}
</p>
) : null}
</div>
<div className="cf-rs-hook-num">
<span className="cf-rs-hook-gift" aria-hidden="true">
<Gift size={20} strokeWidth={2.5} />
</span>
<span className="cf-rs-num">{reward}</span>
<span className="cf-rs-num-cap">{copy.rewardCaption}</span>
</div>
</div>
{n > 0 ? (
<div className="cf-rs-panel cf-rs-progress">
<div>
<h3 className="cf-rs-h3">{progressLine}</h3>
<p className="cf-rs-body">{progressNote}</p>
</div>
<div className="cf-rs-tracker" style={trackerStyle}>
<div
className="cf-rs-bar"
role="progressbar"
aria-label={copy.progressLabel}
aria-valuemin={0}
aria-valuemax={max}
aria-valuenow={Math.min(Math.max(referrals, 0), max)}
>
<span className="cf-rs-track" />
<span className="cf-rs-fill" />
</div>
<ol className="cf-rs-tiers">
{sorted.map((t, i) => {
const done = referrals >= t.count
const isNext = next ? t.count === next.count && t.reward === next.reward : false
return (
<li
key={`${i}-${t.count}`}
className={`cf-rs-tier ${done ? "is-done" : isNext ? "is-next" : "is-locked"}`}
>
<span className="cf-rs-node" aria-hidden="true">
{done ? <Check size={20} strokeWidth={3} /> : <Gift size={20} strokeWidth={2.5} />}
</span>
<span className="cf-rs-tier-count">
{fill(t.count === 1 ? copy.tierOne : copy.tierMany, { count: t.count })}
</span>
<span className="cf-rs-tier-reward">{t.reward}</span>
<span className="cf-rs-sr">
{done ? copy.tierDone : isNext ? copy.tierNext : copy.tierLocked}
</span>
</li>
)
})}
</ol>
</div>
</div>
) : null}
<div className="cf-rs-panel cf-rs-action">
<h3 className="cf-rs-h3">{copy.actionLine}</h3>
<div className="cf-rs-linkgroup">
<label className="cf-rs-label" htmlFor={inputId}>
{copy.linkLabel}
</label>
<div className="cf-rs-linkbar">
<div className="cf-rs-field">
<span className="cf-rs-field-icon" aria-hidden="true">
<Link2 size={20} strokeWidth={2.5} />
</span>
<input
ref={inputRef}
id={inputId}
className="cf-rs-input"
type="text"
readOnly
value={link}
placeholder={copy.linkPlaceholder}
disabled={disabled}
aria-invalid={shown === "error" ? true : undefined}
aria-describedby={shown === "error" ? errorId : undefined}
onFocus={(e) => e.currentTarget.select()}
/>
</div>
<button
type="button"
className={copyClass}
onClick={handleCopy}
disabled={disabled}
aria-describedby={shown === "error" ? errorId : undefined}
>
{shown === "copied" ? (
<Check size={20} strokeWidth={2.5} aria-hidden="true" />
) : (
<Copy size={20} strokeWidth={2.5} aria-hidden="true" />
)}
<span>{shown === "copied" ? copy.copiedLabel : copy.copyLabel}</span>
</button>
</div>
{shown === "error" ? (
<p className="cf-rs-error" id={errorId} role="alert">
<CircleAlert size={18} strokeWidth={2.5} aria-hidden="true" />
{copy.copyError}
</p>
) : null}
<p className="cf-rs-sr" aria-live="polite">
{shown === "copied" ? copy.copiedAnnounce : ""}
</p>
</div>
{channels.length > 0 ? (
<div className="cf-rs-sharegroup">
<p className="cf-rs-share-lead">{copy.shareLead}</p>
<ul className="cf-rs-share">
{channels.map((ch) => {
const label = copy.channels[ch]
const href = shareHref(ch, link, shareText, copy.shareSubject)
const web = ch !== "email" && ch !== "sms"
const icon = <ChannelIcon channel={ch} />
return (
<li key={ch}>
{disabled ? (
<button type="button" className="cf-rs-chan" disabled>
{icon}
<span>{label}</span>
</button>
) : (
<a
className="cf-rs-chan"
href={href}
target={web ? "_blank" : undefined}
rel={web ? "noopener noreferrer" : undefined}
onClick={() => {
if (onShare) onShare(ch, href)
}}
>
{icon}
<span>{label}</span>
</a>
)}
</li>
)
})}
</ul>
</div>
) : null}
{note ? (
<p className="cf-rs-note">
<ShieldCheck size={18} strokeWidth={2.5} aria-hidden="true" />
{note}
</p>
) : null}
</div>
</section>
)
}
export default ReferralShare3
const DEFAULT_COPY: ReferralShare3Copy = {
headline: "Send a friend your link. Get {reward} back every time one buys.",
rewardCaption: "credited to you for every friend who buys",
friendLine: "Your friend gets {friendReward} off their order.",
investmentLabel: "Their investment:",
progressOne: "{count} more friend unlocks {reward}",
progressMany: "{count} more friends unlock {reward}",
progressDone: "Every reward is unlocked. Keep sharing for {reward} a friend.",
noteZero: "Your first friend who buys unlocks your first reward.",
noteOne: "{count} friend has bought with your link so far.",
noteMany: "{count} friends have bought with your link so far.",
tierOne: "{count} friend",
tierMany: "{count} friends",
tierDone: "Unlocked",
tierNext: "Your next reward",
tierLocked: "Still locked",
progressLabel: "Friends who bought with your link",
actionLine: "Copy your link and send it to one friend tonight.",
linkLabel: "Your personal referral link",
linkPlaceholder: "https://yoursite.com/r/your-name",
copyLabel: "Copy My Link",
copiedLabel: "Link Copied",
copiedAnnounce: "Your referral link is copied. Paste it anywhere.",
copyError: "Copying was blocked here. Tap the link, select it all and copy it by hand.",
shareLead: "Or send it straight from here:",
shareSubject: "Thought of you when I got this",
channels: {
email: "Email",
sms: "Text",
facebook: "Facebook",
x: "Post on X",
linkedin: "LinkedIn",
},
}
// private: share icons. Email and text use lucide; social networks use their official single-colour marks in currentColor.
function ChannelIcon({ channel }: { channel: ReferralShare3Channel }) {
if (channel === "email") return <Mail size={20} strokeWidth={2.5} aria-hidden="true" />
if (channel === "sms") return <MessageSquare size={20} strokeWidth={2.5} aria-hidden="true" />
const marks: Record<"facebook" | "x" | "linkedin", { name: string; d: string }> = {
facebook: {
name: "Facebook",
d: "M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z",
},
x: {
name: "X",
d: "M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z",
},
linkedin: {
name: "LinkedIn",
d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.889 1.637-1.825 3.37-1.825 3.601 0 4.267 2.37 4.267 4.892v6.824zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z",
},
}
const mark = marks[channel]
return (
<svg
className="cf-rs-mark"
data-official-mark={mark.name}
width="18"
height="18"
viewBox="0 0 24 24"
fill="currentColor"
aria-hidden="true"
focusable="false"
>
<path d={mark.d} />
</svg>
)
}
const useIsoLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect
function fill(template: string, vars: Record<string, string | number>): string {
return template.replace(/\{(\w+)\}/g, (match: string, key: string) =>
Object.prototype.hasOwnProperty.call(vars, key) ? String(vars[key]) : match,
)
}
function shareHref(channel: ReferralShare3Channel, link: string, text: string, subject: string): string {
const u = encodeURIComponent(link)
if (channel === "email") {
return `mailto:?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(text + "\n\n" + link)}`
}
if (channel === "sms") return `sms:?&body=${encodeURIComponent(text + " " + link)}`
if (channel === "facebook") return `https://www.facebook.com/sharer/sharer.php?u=${u}`
if (channel === "x") return `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}&url=${u}`
return `https://www.linkedin.com/sharing/share-offsite/?url=${u}`
}
// Tier nodes sit at column centres; the fill runs from 0 at the left edge, piecewise between tiers.
function progressPosition(value: number, tiers: ReferralShare3Tier[]): number {
const n = tiers.length
if (!n || value <= 0) return 0
let prevCount = 0
let prevPos = 0
for (let i = 0; i < n; i++) {
const c = tiers[i].count
const p = ((i + 0.5) / n) * 100
if (value <= c) return prevPos + ((value - prevCount) / Math.max(1, c - prevCount)) * (p - prevPos)
prevCount = c
prevPos = p
}
return prevPos
}
const STYLES = `
.cf-rs{--rs-radius:var(--card-radius,var(--radius,14px));--rs-shadow:var(--shadow,oklch(0.22 0.03 260));--rs-card-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(from var(--rs-shadow) l c h / .22),0 4px 10px -2px oklch(from var(--rs-shadow) l c h / .2)));display:grid;gap:16px;width:100%;max-width:60rem;margin-inline:auto;font-family:var(--font-body);color:var(--ink);}
.cf-rs *,.cf-rs *::before,.cf-rs *::after{box-sizing:border-box;}
.cf-rs-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}
.cf-rs-hook{display:grid;grid-template-columns:minmax(0,1fr) minmax(12rem,30%);background:var(--band);color:var(--band-ink);border-radius:var(--rs-radius);overflow:hidden;box-shadow:var(--rs-card-shadow);}
.cf-rs-hook-copy{display:grid;align-content:start;gap:16px;padding:clamp(24px,4vw,44px);}
.cf-rs-h2{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-rs-friend{margin: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-rs-invest{display:block;margin-top:8px;}
.cf-rs-invest-label{font-size:.875rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;}
.cf-rs-invest strong{font-weight:800;font-variant-numeric:tabular-nums;}
.cf-rs-hook-num{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:12px;padding:clamp(24px,4vw,44px);background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));box-shadow:inset 1px 0 0 oklch(from var(--accent-fill,var(--accent)) calc(l + .08) c h / .5);}
.cf-rs-hook-gift{display:inline-grid;place-items:center;width:40px;height:40px;border-radius:999px;background:oklch(from var(--accent-fill-ink,var(--card)) l c h / .14);}
.cf-rs-num{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,5.4vw,4.875rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;}
.cf-rs-num-cap{font-size:.9375rem;line-height:1.4;font-weight:600;text-wrap:pretty;}
.cf-rs-panel{display:grid;gap:24px;padding:clamp(20px,3vw,32px);background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));border-radius:var(--rs-radius);box-shadow:var(--rs-card-shadow);}
.cf-rs-action{border-color:color-mix(in oklch,var(--accent) 34%,var(--card));box-shadow:var(--shadow-lg,0 2px 4px oklch(from var(--rs-shadow) l c h / .22),0 12px 24px -8px oklch(from var(--rs-shadow) l c h / .32));}
.cf-rs-h3{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:-0.01em;text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;text-wrap:balance;color:var(--ink);}
.cf-rs-body{margin:8px 0 0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--muted);text-wrap:pretty;}
.cf-rs-tracker{position:relative;}
.cf-rs-bar{position:absolute;left:0;right:0;top:16px;height:8px;}
.cf-rs-track,.cf-rs-fill{position:absolute;top:0;left:0;height:100%;border-radius:999px;}
.cf-rs-track{width:var(--rs-track);background:color-mix(in oklch,var(--ink) 10%,var(--card));}
.cf-rs-fill{width:var(--rs-fill);background:linear-gradient(90deg,oklch(from var(--accent-fill,var(--accent)) calc(l + .06) c h),var(--accent-fill,var(--accent)));transform-origin:left center;}
.cf-rs-tiers{position:relative;display:grid;grid-template-columns:repeat(var(--rs-n),minmax(0,1fr));margin:0;padding:0;list-style:none;}
.cf-rs-tier{position:relative;display:grid;justify-items:center;align-content:start;gap:4px;padding-inline:4px;text-align:center;}
.cf-rs-node{display:grid;place-items:center;width:40px;height:40px;margin-bottom:8px;border-radius:999px;}
.cf-rs-tier.is-done .cf-rs-node{background:var(--success);color:var(--rs-badge-glyph,#fff);box-shadow:var(--shadow-sm,0 1px 2px oklch(from var(--rs-shadow) l c h / .25));}
.cf-rs-tier.is-next .cf-rs-node{background:color-mix(in oklch,var(--accent) 12%,var(--card));color:var(--accent);border:3px solid var(--accent-fill,var(--accent));}
.cf-rs-tier.is-locked .cf-rs-node{background:color-mix(in oklch,var(--ink) 6%,var(--card));color:var(--muted);border:1px solid oklch(from var(--ink) l c h / .14);}
.cf-rs-tier-count{font-size:.9375rem;line-height:1.3;font-weight:800;color:var(--ink);}
.cf-rs-tier-reward{font-size:.9375rem;line-height:1.35;font-weight:500;color:var(--muted);text-wrap:balance;}
.cf-rs-tier.is-next .cf-rs-tier-reward{color:var(--ink);font-weight:700;}
.cf-rs-linkgroup{display:grid;gap:8px;}
.cf-rs-label{font-size:1.0625rem;line-height:1.3;font-weight:700;color:var(--label-ink,var(--ink));}
.cf-rs-linkbar{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;}
.cf-rs-field{position:relative;min-width:0;}
.cf-rs-field-icon{position:absolute;left:18px;top:50%;display:inline-flex;transform:translateY(-50%);color:color-mix(in oklch,var(--field-ink) 65%,var(--field));pointer-events:none;}
.cf-rs-input{width:100%;height:56px;padding:0 16px 0 50px;font-family:var(--font-body);font-size:1.0625rem;font-weight:600;line-height:1.2;color:var(--field-ink);background:var(--field);border:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));text-overflow:ellipsis;transition:border-color .16s ease,box-shadow .16s ease;}
.cf-rs-input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1;}
.cf-rs-input:focus-visible{outline:none;border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent)) l c h / .35);}
.cf-rs-input[aria-invalid="true"]{border-color:var(--danger);}
.cf-rs-input[aria-invalid="true"]:focus-visible{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / .3);}
.cf-rs-input:disabled{background:color-mix(in oklch,var(--ink) 4%,var(--field));color:color-mix(in oklch,var(--field-ink) 60%,var(--field));cursor:not-allowed;}
.cf-rs-copy{--rs-bb:var(--button-bg,var(--cta));display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:56px;min-width:13rem;padding:0 28px;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:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;white-space:nowrap;color:var(--button-ink,var(--cta-ink));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--rs-bb) calc(l + .04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--rs-bb) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--rs-bb) calc(l - .16) c h),0 1px 2px oklch(from var(--rs-shadow) l c h / .3),0 8px 16px -6px oklch(from var(--rs-shadow) l c h / .45));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease;}
.cf-rs-copy:hover:not(:disabled),.cf-rs-copy.is-hover{transform:translateY(-1px);background:linear-gradient(oklch(from var(--rs-bb) calc(l - .01) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--rs-bb) calc(l + .12) c h / .7),inset 0 -3px 0 oklch(from var(--rs-bb) calc(l - .2) c h),0 1px 2px oklch(from var(--rs-shadow) l c h / .32),0 10px 18px -6px oklch(from var(--rs-shadow) l c h / .55));}
.cf-rs-copy:active:not(:disabled),.cf-rs-copy.is-active{transform:translateY(1px);background:linear-gradient(oklch(from var(--rs-bb) calc(l - .05) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .08) c h));box-shadow:inset 0 2px 4px oklch(from var(--rs-bb) calc(l - .22) c h / .55),inset 0 -2px 0 oklch(from var(--rs-bb) calc(l - .16) c h),0 1px 2px oklch(from var(--rs-shadow) l c h / .3);}
.cf-rs-copy:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / .55);outline-offset:3px;}
.cf-rs-copy:disabled{background:var(--secondary);color:color-mix(in oklch,var(--secondary-ink) 60%,var(--secondary));text-shadow:none;box-shadow:none;cursor:not-allowed;}
.cf-rs-error{margin:0;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--danger);text-wrap:pretty;}
.cf-rs-error svg{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em;}
.cf-rs-sharegroup{display:grid;gap:12px;}
.cf-rs-share-lead{margin:0;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted);}
.cf-rs-share{display:grid;grid-template-columns:repeat(auto-fit,minmax(9.5rem,1fr));gap:8px;margin:0;padding:0;list-style:none;}
.cf-rs-share li{display:flex;}
.cf-rs-chan{display:inline-flex;flex:1;align-items:center;justify-content:center;gap:10px;min-height:56px;padding:0 16px;border:1px solid var(--button-2-border,transparent);border-radius:var(--button-radius,var(--radius,12px));background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:var(--button-2-shadow,var(--shadow-sm));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:1.0625rem;line-height:1.15;white-space:nowrap;text-decoration:none;cursor:pointer;transition:transform .16s ease,background .16s ease,box-shadow .16s ease;}
.cf-rs-mark{flex:0 0 auto;}
.cf-rs-chan:hover:not(:disabled){transform:translateY(-1px);background:color-mix(in oklch,var(--button-2-ink,var(--secondary-ink)) 8%,var(--button-2-bg,var(--secondary)));}
.cf-rs-chan:active:not(:disabled){transform:translateY(0);background:color-mix(in oklch,var(--button-2-ink,var(--secondary-ink)) 14%,var(--button-2-bg,var(--secondary)));box-shadow:none;}
.cf-rs-chan:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / .55);outline-offset:2px;}
.cf-rs-chan:disabled{color:color-mix(in oklch,var(--button-2-ink,var(--secondary-ink)) 55%,var(--button-2-bg,var(--secondary)));box-shadow:none;cursor:not-allowed;}
.cf-rs-note{margin:0;padding-top:16px;border-top:1px solid oklch(from var(--ink) l c h / .1);font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty;}
.cf-rs-note svg{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em;color:var(--success);}
.cf-rs[data-motion]>div{transition:opacity .45s cubic-bezier(.2,.7,.2,1),transform .45s cubic-bezier(.2,.7,.2,1);}
.cf-rs[data-motion]>div:nth-of-type(2){transition-delay:.07s;}
.cf-rs[data-motion]>div:nth-of-type(3){transition-delay:.14s;}
.cf-rs[data-motion] .cf-rs-fill{transition:transform .9s cubic-bezier(.2,.7,.2,1) .2s;}
.cf-rs[data-motion="armed"]>div{opacity:.82;transform:translateY(8px);}
.cf-rs[data-motion="armed"] .cf-rs-fill{transform:scaleX(0);}
.cf-rs[data-motion="in"] .cf-rs-tier.is-done .cf-rs-node{animation:cf-rs-pop .3s ease .5s both;}
@keyframes cf-rs-pop{from{transform:scale(.9);}}
@media (max-width:720px){
.cf-rs-hook{grid-template-columns:1fr;}
.cf-rs-hook-num{flex-direction:row;flex-wrap:wrap;justify-content:flex-start;align-items:center;gap:16px;box-shadow:inset 0 1px 0 oklch(from var(--accent-fill,var(--accent)) calc(l + .08) c h / .5);}
.cf-rs-hook-gift{display:none;}
.cf-rs-num-cap{flex:1 1 9rem;}
}
@media (max-width:560px){
.cf-rs-linkbar{grid-template-columns:1fr;}
.cf-rs-copy{width:100%;min-width:0;}
.cf-rs-share{grid-template-columns:repeat(2,minmax(0,1fr));}
.cf-rs-share li:last-child:nth-child(odd){grid-column:1 / -1;}
}
@media (prefers-reduced-motion:reduce){
.cf-rs[data-motion]>div,.cf-rs[data-motion] .cf-rs-fill{transition:none;opacity:1;transform:none;}
.cf-rs-tier.is-done .cf-rs-node,.cf-rs[data-motion="in"] .cf-rs-tier.is-done .cf-rs-node{animation:none;}
.cf-rs-copy,.cf-rs-chan,.cf-rs-input{transition:none;}
.cf-rs-copy:hover:not(:disabled),.cf-rs-copy.is-hover,.cf-rs-copy:active:not(:disabled),.cf-rs-copy.is-active,.cf-rs-chan:hover:not(:disabled){transform:none;}
}
`
pieces/checkout/referral-share-3/specimen.tsx 28 lines
import { ReferralShare3 } from "../referral-share-3"
import defaults from "../../studio-defaults.json"
type State = "default" | "hover" | "active" | "disabled" | "error" | "success"
export const states: State[] = ["default", "hover", "active", "disabled", "error", "success"]
export default function ReferralShare3Specimen({ state = "default" }: { state?: State }) {
const s = defaults.sample
return (
<ReferralShare3
state={state}
reward="$10"
friendReward="$10"
investmentPrice="$37"
referrals={2}
tiers={[
{ count: 1, reward: "$10 back" },
{ count: 3, reward: "$30 back" },
{ count: 5, reward: "Your kit, free" },
]}
link="https://funnelstarterkit.co/r/dana-r"
shareText={`I just picked up ${s.name} and thought of you. My link takes $10 off:`}
note={`Your credit lands once your friend's ${s.guarantee} window closes.`}
copy={{ friendLine: `Your friend gets {friendReward} off ${s.name}.` }}
/>
)
}
| Name | Type | Details |
|---|---|---|
reward RequiredReferralShare3 |
string |
|
friendReward OptionalReferralShare3 |
string |
|
investmentPrice OptionalReferralShare3 |
string |
|
referrals OptionalReferralShare3 |
number |
|
tiers OptionalReferralShare3 |
ReferralShare3Tier[] |
|
link RequiredReferralShare3 |
string |
|
shareText OptionalReferralShare3 |
string |
|
channels OptionalReferralShare3 |
ReferralShare3Channel[] |
|
note OptionalReferralShare3 |
React.ReactNode |
|
copy OptionalReferralShare3 |
Partial<Omit<ReferralShare3Copy, "channels">> & {
channels?: Partial<Record<ReferralShare3Channel, string>>
} |
|
onCopy OptionalReferralShare3 |
(link: string) => void |
|
onShare OptionalReferralShare3 |
(channel: ReferralShare3Channel, href: string) => void |
|
disabled OptionalReferralShare3 |
boolean |
|
state OptionalReferralShare3 |
"default" | "hover" | "active" | "disabled" | "error" | "success" |
|
className OptionalReferralShare3 |
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--field-border--field-focus--field-ink--field-radius- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
This piece reads no image slots.
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB