Referral Share 2
Refer-a-friend band: an angled dark field sells the reward per friend and what the friend pays, while a raised card tracks progress to the next reward tier and hands over the link to copy and share.
Use it in a prompt
Use checkout/referral-share-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/checkout/referral-share-2.tsx. - Import it and pass your copy and images (Props tab):
import { ReferralShare2 } from "@/components/funneldna/checkout/referral-share-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/referral-share-2/component.tsx 613 lines
// layout: diagonal-split
// Refer-a-friend band: an angled dark field sells the reward per friend and what the friend pays, while a raised card tracks progress to the next reward tier and hands over the link to copy and share.
import * as React from "react"
import { Check, CircleAlert, Copy, Gift, Lock, Mail, MessageSquare, ShieldCheck } from "lucide-react"
export type ReferralShare2Channel = "email" | "sms" | "facebook" | "x" | "linkedin"
export type ReferralShare2Tier = {
/** Friends who must buy to unlock this tier. */
count: number
/** The supplied reward for reaching it, e.g. "$25 bonus". */
reward: string
}
export type ReferralShare2Copy = {
/** Headline; {reward} is replaced with the reward per friend. */
headline: string
/** Line beside the big reward figure. */
rewardCaption: string
/** One-sentence lines under the reward; {reward} is replaced. */
punch: string[]
/** The single-word closing line. */
punchEnd: string
/** Lead-in above the product the friend gets. */
friendLabel: string
/** Screen-reader labels for the two prices. */
regularLabel: string
todayLabel: string
/** Next tier selected: {count} friends left, {reward} of that tier. */
readoutOne: string
readoutMany: string
/** Every tier reached; {reward} is the reward per friend. */
readoutDone: string
/** A reached tier selected: {tier} label and {reward}. */
readoutUnlocked: string
/** A later tier selected: {tier} label and {reward}. */
readoutLocked: string
/** No tiers supplied; {reward} is the reward per friend. */
readoutNone: string
countZero: string
/** {count} is the number of friends who bought. */
countOne: string
countMany: string
/** Tier labels; {count} is replaced. */
tierOne: string
tierMany: string
/** Screen-reader status for each tier. */
tierDone: string
tierNext: string
tierLocked: string
trackerLabel: string
linkLabel: string
linkPlaceholder: string
copyLabel: string
copiedLabel: string
copiedAnnounce: string
copyError: string
/** The plain line under the copy button. */
quietLine: string
/** Email subject for the email share. */
shareSubject: string
channels: Record<ReferralShare2Channel, string>
}
export type ReferralShare2Props = {
/** The supplied reward per referral, short, e.g. "$10". */
reward: string
/** The visitor's personal referral link. */
link: string
/** The product the friend gets; shows the friend row. */
productName?: string
/** Product cut-out on a transparent background (slot "product"). */
productImage?: string
productImageAlt?: string
/** What the friend pays today, e.g. "$47". */
price?: string
/** The supplied regular price, slashed beside today's price. */
regularPrice?: string
/** Friends who have bought with this link so far. */
referrals?: number
/** Supplied reward tiers; the tracker hides when empty. */
tiers?: ReferralShare2Tier[]
/** Prefilled message for email, text and social shares. */
shareText?: string
channels?: ReferralShare2Channel[]
/** Optional terms line at the foot of the card. */
note?: React.ReactNode
copy?: Partial<Omit<ReferralShare2Copy, "channels">> & {
channels?: Partial<Record<ReferralShare2Channel, string>>
}
/** Called after the link is copied. */
onCopy?: (link: string) => void
/** Called when a share button is clicked, before it opens. */
onShare?: (channel: ReferralShare2Channel, href: string) => void
disabled?: boolean
state?: "default" | "hover" | "active" | "disabled" | "error" | "success"
className?: string
}
export function ReferralShare2(props: ReferralShare2Props) {
const {
reward,
link,
productName,
productImage,
productImageAlt,
price,
regularPrice,
referrals = 0,
tiers = [],
shareText = "I used this to plan my first funnel. Thought you'd want it:",
channels = ["email", "sms", "facebook", "x", "linkedin"],
note,
onCopy,
onShare,
state = "default",
className,
} = props
const copy: ReferralShare2Copy = {
...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 = `rs2${uid}-head`
const inputId = `rs2${uid}-link`
const errorId = `rs2${uid}-error`
const rootRef = React.useRef<HTMLElement>(null)
const inputRef = React.useRef<HTMLInputElement>(null)
const timer = React.useRef<number | null>(null)
const [status, setStatus] = React.useState<"idle" | "copied" | "error">("idle")
const [picked, setPicked] = React.useState<number | null>(null)
// "static" is 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 nextIdx = sorted.findIndex((t) => t.count > referrals)
const sel = picked !== null && picked < n ? picked : nextIdx >= 0 ? nextIdx : n - 1
const tierLabel = (c: number) => fill(c === 1 ? copy.tierOne : copy.tierMany, { count: c })
let readout: string
if (!n) readout = fill(copy.readoutNone, { reward })
else if (picked === null && nextIdx < 0) readout = fill(copy.readoutDone, { reward })
else {
const t = sorted[sel]
const left = t.count - referrals
if (left <= 0) readout = fill(copy.readoutUnlocked, { tier: tierLabel(t.count), reward: t.reward })
else if (sel === nextIdx) readout = fill(left === 1 ? copy.readoutOne : copy.readoutMany, { count: left, reward: t.reward })
else readout = fill(copy.readoutLocked, { tier: tierLabel(t.count), reward: t.reward })
}
const countLine =
referrals <= 0 ? copy.countZero : fill(referrals === 1 ? copy.countOne : copy.countMany, { count: referrals })
const trackerStyle = {
"--rs2-n": n,
"--rs2-fill": pct(fillFraction(sorted, referrals)),
"--rs2-end": n ? pct((n - 0.5) / n) : "0%",
} as React.CSSProperties
const directCount = channels.filter((c) => c === "email" || c === "sms").length
const btnState = state === "hover" ? " is-hover" : state === "active" ? " is-active" : ""
const rootClass = ["cf-referral-share-2", motion === "armed" ? "is-armed" : motion === "in" ? "is-in" : "", className || ""]
.filter(Boolean)
.join(" ")
const showFriend = Boolean(productName || price)
return (
<section ref={rootRef} className={rootClass} aria-labelledby={headId}>
<style>{CSS}</style>
<div className="rs2-stripe" aria-hidden="true" />
<div className="rs2-field" aria-hidden="true" />
<div className="rs2-wrap">
<div className="rs2-lead-wrap">
<div className="rs2-lead">
<h2 id={headId} className="rs2-h2 rs2-rv" style={rv(0)}>
{fill(copy.headline, { reward })}
</h2>
<div className="rs2-reward rs2-rv" style={rv(1)}>
<span className="rs2-num">{reward}</span>
<p className="rs2-cap">{copy.rewardCaption}</p>
</div>
<div className="rs2-punch rs2-rv" style={rv(2)}>
{copy.punch.map((line, i) => (
<p key={i}>{fill(line, { reward })}</p>
))}
{copy.punchEnd ? <p className="rs2-done">{copy.punchEnd}</p> : null}
</div>
{showFriend ? (
<div className={"rs2-friend rs2-rv" + (productImage ? "" : " is-text")} style={rv(3)}>
{productImage ? (
<img
src={productImage}
alt={productImageAlt || productName || ""}
width={176}
height={176}
loading="lazy"
decoding="async"
/>
) : null}
<div>
<p className="rs2-friend-label">{copy.friendLabel}</p>
{productName ? <p className="rs2-friend-name">{productName}</p> : null}
{price ? (
<p className="rs2-price">
{regularPrice ? (
<span className="rs2-was">
<span className="rs2-sr">{copy.regularLabel} </span>
{regularPrice}
</span>
) : null}
<span className="rs2-now">
<span className="rs2-sr">{copy.todayLabel} </span>
{price}
</span>
</p>
) : null}
</div>
</div>
) : null}
</div>
</div>
<div className="rs2-card rs2-rv" style={rv(2)}>
<div className="rs2-readout" aria-live="polite">
<h3 className="rs2-h3">{readout}</h3>
<p className="rs2-count">{countLine}</p>
</div>
{n ? (
<div className="rs2-tracker" role="group" aria-label={copy.trackerLabel} style={trackerStyle}>
<span className="rs2-track" aria-hidden="true" />
<span className="rs2-fill" aria-hidden="true" />
{sorted.map((t, i) => {
const st = referrals >= t.count ? "done" : i === nextIdx ? "next" : "locked"
return (
<button
key={t.count + "-" + i}
type="button"
className={"rs2-tier is-" + st}
aria-pressed={i === sel}
onClick={() => setPicked(i)}
>
<span className={"rs2-disc rs2-disc--" + st} aria-hidden="true">
{st === "done" ? (
<Check size={20} strokeWidth={3} />
) : st === "next" ? (
<Gift size={20} strokeWidth={2.5} />
) : (
<Lock size={20} strokeWidth={2.5} />
)}
</span>
<span className="rs2-tier-text">
<span className="rs2-tier-count">{tierLabel(t.count)}</span>
<span className="rs2-tier-reward">{t.reward}</span>
<span className="rs2-sr">
, {st === "done" ? copy.tierDone : st === "next" ? copy.tierNext : copy.tierLocked}
</span>
</span>
</button>
)
})}
</div>
) : null}
<div className="rs2-link">
<label className="rs2-label" htmlFor={inputId}>
{copy.linkLabel}
</label>
<input
ref={inputRef}
id={inputId}
className="rs2-input"
type="url"
readOnly
value={link}
placeholder={copy.linkPlaceholder}
disabled={disabled}
spellCheck={false}
aria-invalid={shown === "error" || undefined}
aria-describedby={shown === "error" ? errorId : undefined}
onFocus={(e) => e.currentTarget.select()}
onClick={(e) => e.currentTarget.select()}
/>
{shown === "error" ? (
<p id={errorId} className="rs2-error" role="alert">
<CircleAlert size={16} strokeWidth={2.5} aria-hidden="true" />
{copy.copyError}
</p>
) : null}
<button
type="button"
className={"rs2-copy" + btnState}
onClick={handleCopy}
disabled={disabled}
>
{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>
<span className="rs2-sr" aria-live="polite">
{shown === "copied" ? copy.copiedAnnounce : ""}
</span>
{channels.length ? (
<>
<p className="rs2-quiet">{copy.quietLine}</p>
<ul className="rs2-shares">
{channels.map((ch) => {
const href = shareHref(ch, link, shareText, copy.shareSubject)
const social = ch !== "email" && ch !== "sms"
const wide = !social && directCount === 2
return (
<li key={ch} className={wide ? "is-wide" : undefined}>
<a
className="rs2-share"
href={disabled ? undefined : href}
target={social ? "_blank" : undefined}
rel={social ? "noopener noreferrer" : undefined}
aria-disabled={disabled || undefined}
tabIndex={disabled ? -1 : undefined}
onClick={(e) => {
if (disabled) {
e.preventDefault()
return
}
if (onShare) onShare(ch, href)
}}
>
<ChannelIcon channel={ch} />
<span className={"rs2-share-label" + (social ? " is-social" : "")}>{copy.channels[ch]}</span>
</a>
</li>
)
})}
</ul>
</>
) : null}
{note ? (
<p className="rs2-note">
<ShieldCheck size={16} strokeWidth={2.5} aria-hidden="true" />
{note}
</p>
) : null}
</div>
</div>
</div>
</section>
)
}
export default ReferralShare2
const useIsoLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect
function fill(template: string, values: Record<string, string | number>): string {
let out = template
for (const key of Object.keys(values)) out = out.split(`{${key}}`).join(String(values[key]))
return out
}
function rv(i: number): React.CSSProperties {
return { "--i": i } as React.CSSProperties
}
function pct(f: number): string {
return `${Math.round(Math.max(0, Math.min(1, f)) * 10000) / 100}%`
}
// Fill position as a fraction of the tracker width; tier i sits at the centre of its column.
function fillFraction(sorted: ReferralShare2Tier[], referrals: number): number {
const n = sorted.length
if (!n) return 0
let prevCount = 0
let prevPos = 0
for (let i = 0; i < n; i++) {
const pos = (i + 0.5) / n
const c = sorted[i].count
if (referrals < c) {
const span = c - prevCount
const t = span > 0 ? Math.max(0, referrals - prevCount) / span : 0
return prevPos + (pos - prevPos) * t
}
prevCount = c
prevPos = pos
}
return (n - 0.5) / n
}
function shareHref(channel: ReferralShare2Channel, link: string, text: string, subject: string): string {
const e = encodeURIComponent
if (channel === "email") return `mailto:?subject=${e(subject)}&body=${e(text)}%0A%0A${e(link)}`
if (channel === "sms") return `sms:?&body=${e(text + " " + link)}`
if (channel === "facebook") return `https://www.facebook.com/sharer/sharer.php?u=${e(link)}`
if (channel === "x") return `https://twitter.com/intent/tweet?text=${e(text)}&url=${e(link)}`
return `https://www.linkedin.com/sharing/share-offsite/?url=${e(link)}`
}
// Official social marks (Simple Icons paths), drawn in currentColor so they follow the button tokens.
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-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 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",
},
}
function ChannelIcon({ channel }: { channel: ReferralShare2Channel }) {
if (channel === "email") return <Mail size={18} strokeWidth={2.5} aria-hidden="true" />
if (channel === "sms") return <MessageSquare size={18} strokeWidth={2.5} aria-hidden="true" />
const mark = MARKS[channel]
return (
<svg viewBox="0 0 24 24" width={18} height={18} fill="currentColor" aria-hidden="true" data-official-mark={mark.name}>
<path d={mark.d} />
</svg>
)
}
const DEFAULT_COPY: ReferralShare2Copy = {
headline: "Give a friend the kit. Get {reward} back.",
rewardCaption: "for every friend who buys with your link",
punch: ["Copy your link.", "Send it to one friend who's building a funnel.", "They buy. You get {reward}."],
punchEnd: "Done.",
friendLabel: "Your friend gets",
regularLabel: "Regular price",
todayLabel: "Price today",
readoutOne: "1 more friend unlocks {reward}",
readoutMany: "{count} more friends unlock {reward}",
readoutDone: "Every reward unlocked. You still get {reward} per friend.",
readoutUnlocked: "Unlocked at {tier}: {reward}",
readoutLocked: "Reach {tier} to unlock {reward}",
readoutNone: "Every friend who buys earns you {reward}",
countZero: "Nobody has used your link yet. Your first share starts the count.",
countOne: "1 friend has bought with your link so far.",
countMany: "{count} friends have bought with your link so far.",
tierOne: "{count} friend",
tierMany: "{count} friends",
tierDone: "unlocked",
tierNext: "next reward",
tierLocked: "locked",
trackerLabel: "Reward tiers",
linkLabel: "Your personal link",
linkPlaceholder: "https://yoursite.com/r/your-name",
copyLabel: "Copy my link",
copiedLabel: "Link copied",
copiedAnnounce: "Your link is copied. Paste it anywhere.",
copyError: "Couldn't copy automatically. Tap the link, select it and copy it by hand.",
quietLine: "or send it straight from here",
shareSubject: "Thought of you",
channels: { email: "Email", sms: "Text", facebook: "Facebook", x: "X", linkedin: "LinkedIn" },
}
// Colours are tokens only; the white glyph inside the solid success badge is a var() fallback (theme contract: status icon badges).
// The section paints --band so the lead copy always sits on its real background; the surface side is the angled layer.
const CSS = `
.cf-referral-share-2{--rs2-gutter:clamp(16px,5vw,48px);--rs2-sh:var(--shadow, oklch(0.22 0.03 260));position:relative;isolation:isolate;overflow:hidden;background:var(--band);color:var(--band-ink);font-family:var(--font-body);padding:clamp(56px,8vw,112px) 0 clamp(64px,8.5vw,120px)}
.cf-referral-share-2 *,.cf-referral-share-2 *::before,.cf-referral-share-2 *::after{box-sizing:border-box}
.cf-referral-share-2 .rs2-stripe,.cf-referral-share-2 .rs2-field{position:absolute;inset:0;z-index:-1;pointer-events:none}
.cf-referral-share-2 .rs2-stripe{background:var(--accent-fill, var(--accent));clip-path:polygon(calc(50% + 142px) 0,100% 0,100% 100%,calc(50% + 12px) 100%)}
.cf-referral-share-2 .rs2-field{background:var(--surface);clip-path:polygon(calc(50% + 160px) 0,100% 0,100% 100%,calc(50% + 30px) 100%)}
.cf-referral-share-2 .rs2-wrap{position:relative;max-width:calc(1120px + 2 * var(--rs2-gutter));margin:0 auto;padding:0 var(--rs2-gutter);display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:clamp(32px,5vw,72px);align-items:start}
.cf-referral-share-2 .rs2-lead{color:var(--band-ink);padding-top:8px}
.cf-referral-share-2 .rs2-h2{margin:0 0 24px;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-referral-share-2 .rs2-reward{display:flex;flex-wrap:wrap;align-items:center;gap:12px 20px;margin:0 0 28px}
.cf-referral-share-2 .rs2-num{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(3.5rem,7vw,6rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.cf-referral-share-2 .rs2-cap{margin:0;max-width:15rem;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.3;font-weight:500;text-wrap:pretty}
.cf-referral-share-2 .rs2-punch p{margin:0 0 8px;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;text-wrap:pretty}
.cf-referral-share-2 .rs2-punch .rs2-done{margin:16px 0 0;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:-0.01em;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15}
.cf-referral-share-2 .rs2-friend{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:20px;margin-top:32px}
.cf-referral-share-2 .rs2-friend.is-text{grid-template-columns:minmax(0,1fr)}
.cf-referral-share-2 .rs2-friend img{display:block;width:clamp(120px,13vw,176px);height:auto;aspect-ratio:1;object-fit:contain;filter:drop-shadow(0 2px 3px oklch(from var(--rs2-sh) calc(l - 0.08) c h / 0.5)) drop-shadow(0 14px 16px oklch(from var(--rs2-sh) calc(l - 0.08) c h / 0.35))}
.cf-referral-share-2 .rs2-friend-label{margin:0 0 4px;font-size:0.9375rem;font-weight:600;line-height:1.4}
.cf-referral-share-2 .rs2-friend-name{margin:0 0 12px;font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:700;line-height:1.35;text-wrap:pretty}
.cf-referral-share-2 .rs2-price{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 16px;margin:0}
.cf-referral-share-2 .rs2-was{position:relative;display:inline-block;padding:0 2px;font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:600;line-height:1.2;font-variant-numeric:tabular-nums}
.cf-referral-share-2 .rs2-was::after{content:"";position:absolute;left:-6%;right:-6%;top:50%;height:2px;margin-top:-1px;border-radius:2px;background:var(--danger);background:oklch(from var(--danger) max(l, 0.68) c h);transform:rotate(-10deg)}
.cf-referral-share-2 .rs2-now{display:inline-block;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.625rem,2.4vw,2rem);line-height:1;letter-spacing:-0.02em;font-variant-numeric:tabular-nums}
.cf-referral-share-2 .rs2-card{position:relative;z-index:1;container-type:inline-size;background:var(--card);color:var(--ink);border:1px solid var(--card-border, color-mix(in oklch, var(--accent) 22%, var(--card)));border-radius:var(--card-radius, var(--radius, 14px));box-shadow:var(--card-shadow, var(--shadow-lg, 0 2px 4px oklch(from var(--rs2-sh) l c h / 0.22), 0 12px 24px -8px oklch(from var(--rs2-sh) l c h / 0.32)));padding:clamp(20px,3vw,32px)}
.cf-referral-share-2 .rs2-h3{margin:0 0 8px;font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);letter-spacing:-0.01em;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;text-wrap:balance}
.cf-referral-share-2 .rs2-count{margin:0;color:var(--muted);font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
.cf-referral-share-2 .rs2-tracker{position:relative;display:grid;grid-template-columns:repeat(var(--rs2-n),minmax(0,1fr));margin-top:24px}
.cf-referral-share-2 .rs2-track,.cf-referral-share-2 .rs2-fill{position:absolute;left:0;top:24px;height:8px;border-radius:999px}
.cf-referral-share-2 .rs2-track{width:var(--rs2-end);background:color-mix(in oklch, var(--ink) 10%, var(--card))}
.cf-referral-share-2 .rs2-fill{width:var(--rs2-fill);background:var(--accent-fill, var(--accent));transform-origin:left center}
.cf-referral-share-2 .rs2-tier{position:relative;display:flex;flex-direction:column;align-items:center;gap:8px;width:100%;margin:0;padding:8px 4px 0;border:0;border-radius:10px;background:transparent;color:inherit;font:inherit;text-align:center;cursor:pointer}
.cf-referral-share-2 .rs2-tier:focus-visible{outline:3px solid oklch(from var(--accent) l c h / 0.55);outline-offset:2px}
.cf-referral-share-2 .rs2-disc{display:grid;place-items:center;width:40px;height:40px;border-radius:999px;transition:transform .16s ease, box-shadow .16s ease}
.cf-referral-share-2 .rs2-disc--done{background:var(--success);color:var(--rs2-badge-ink, #fff);box-shadow:0 1px 2px oklch(from var(--rs2-sh) l c h / 0.3)}
.cf-referral-share-2 .rs2-disc--next{background:var(--card);color:var(--accent);box-shadow:inset 0 0 0 3px var(--accent-fill, var(--accent)), 0 1px 2px oklch(from var(--rs2-sh) l c h / 0.25)}
.cf-referral-share-2 .rs2-disc--locked{background:var(--secondary, color-mix(in oklch, var(--ink) 8%, var(--card)));color:var(--secondary-ink, var(--ink))}
.cf-referral-share-2 .rs2-tier:hover .rs2-disc{transform:translateY(-2px)}
.cf-referral-share-2 .rs2-tier-text{display:block;width:100%;padding:8px 6px;border-radius:10px;transition:background .16s ease}
.cf-referral-share-2 .rs2-tier:hover .rs2-tier-text{background:color-mix(in oklch, var(--ink) 4%, var(--card))}
.cf-referral-share-2 .rs2-tier[aria-pressed="true"] .rs2-tier-text{background:color-mix(in oklch, var(--accent) 10%, var(--card))}
.cf-referral-share-2 .rs2-tier-count{display:block;margin-bottom:4px;color:var(--muted);font-size:0.875rem;font-weight:800;line-height:1.2;font-variant-numeric:tabular-nums}
.cf-referral-share-2 .rs2-tier-reward{display:block;font-size:0.9375rem;font-weight:700;line-height:1.3;text-wrap:balance;overflow-wrap:anywhere}
.cf-referral-share-2 .rs2-link{margin-top:24px;padding-top:24px;border-top:1px solid oklch(from var(--ink) l c h / 0.12)}
.cf-referral-share-2 .rs2-label{display:block;margin:0 0 8px;color:var(--label-ink, var(--ink));font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:700;line-height:1.3}
.cf-referral-share-2 .rs2-input{display:block;width:100%;height:56px;margin:0;padding:0 16px;font:inherit;font-size:1.0625rem;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-referral-share-2 .rs2-input::placeholder{color:color-mix(in oklch, var(--field-ink) 65%, var(--field));opacity:1}
.cf-referral-share-2 .rs2-input:focus{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 / 0.35)}
.cf-referral-share-2 .rs2-input[aria-invalid="true"]{border-color:var(--danger)}
.cf-referral-share-2 .rs2-input[aria-invalid="true"]:focus{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / 0.3)}
.cf-referral-share-2 .rs2-input:disabled{cursor:not-allowed;color:color-mix(in oklch, var(--field-ink) 60%, var(--field))}
.cf-referral-share-2 .rs2-error{margin:8px 0 0;color:var(--danger);font-size:0.9375rem;font-weight:600;line-height:1.4;text-wrap:pretty}
.cf-referral-share-2 .rs2-error svg,.cf-referral-share-2 .rs2-note svg{display:inline-block;vertical-align:-0.15em;margin-inline-end:0.4em}
.cf-referral-share-2 .rs2-copy{display:inline-flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:56px;margin-top:12px;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;color:var(--button-ink, var(--cta-ink));text-shadow:var(--button-text-shadow, none);background:linear-gradient(oklch(from var(--button-bg, var(--cta)) calc(l + 0.04) c h), oklch(from var(--button-bg-2, var(--cta-2)) calc(l - 0.02) c h));box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--rs2-sh) l c h / 0.3), 0 8px 16px -6px oklch(from var(--rs2-sh) l c h / 0.45));cursor:pointer;transition:transform .16s ease, box-shadow .16s ease, background .16s ease}
.cf-referral-share-2 .rs2-copy:hover,.cf-referral-share-2 .rs2-copy.is-hover{background:linear-gradient(oklch(from var(--button-bg, var(--cta)) calc(l - 0.01) c h), oklch(from var(--button-bg-2, var(--cta-2)) calc(l - 0.07) c h));box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.12) c h / 0.6), inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.2) c h), 0 1px 2px oklch(from var(--rs2-sh) l c h / 0.35), 0 10px 18px -6px oklch(from var(--rs2-sh) l c h / 0.55))}
.cf-referral-share-2 .rs2-copy:active,.cf-referral-share-2 .rs2-copy.is-active{transform:translateY(1px);box-shadow:inset 0 2px 4px oklch(from var(--button-bg, var(--cta)) calc(l - 0.22) c h / 0.6), inset 0 -2px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h), 0 1px 1px oklch(from var(--rs2-sh) l c h / 0.3)}
.cf-referral-share-2 .rs2-copy:focus-visible{outline:3px solid oklch(from var(--accent) l c h / 0.55);outline-offset:3px}
.cf-referral-share-2 .rs2-copy:disabled{cursor:not-allowed;transform:none;text-shadow:none;background:var(--secondary, color-mix(in oklch, var(--ink) 8%, var(--card)));color:color-mix(in oklch, var(--secondary-ink, var(--ink)) 55%, var(--secondary, var(--card)));box-shadow:none}
.cf-referral-share-2 .rs2-quiet{margin:12px 0 0;text-align:center;color:var(--muted);font-size:0.9375rem;font-weight:500;line-height:1.4;text-wrap:pretty}
.cf-referral-share-2 .rs2-shares{list-style:none;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px;margin:12px 0 0;padding:0}
.cf-referral-share-2 .rs2-shares li{grid-column:span 2;min-width:0}
.cf-referral-share-2 .rs2-shares li.is-wide{grid-column:span 3}
.cf-referral-share-2 .rs2-share{display:flex;align-items:center;justify-content:center;gap:8px;min-height:52px;padding:0 12px;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;text-decoration:none;white-space:nowrap;cursor:pointer;transition:transform .16s ease, background .16s ease, box-shadow .16s ease}
.cf-referral-share-2 .rs2-share svg{flex:none;width:18px;height:18px}
.cf-referral-share-2 .rs2-share:hover{transform:translateY(-1px);background:oklch(from var(--button-2-bg, var(--secondary)) calc(l - 0.04) c h)}
.cf-referral-share-2 .rs2-share:active{transform:translateY(0);background:oklch(from var(--button-2-bg, var(--secondary)) calc(l - 0.07) c h)}
.cf-referral-share-2 .rs2-share:focus-visible{outline:3px solid oklch(from var(--accent) l c h / 0.55);outline-offset:2px}
.cf-referral-share-2 .rs2-share[aria-disabled="true"]{cursor:not-allowed;transform:none;opacity:0.55}
.cf-referral-share-2 .rs2-note{margin:20px 0 0;color:var(--muted);font-size:0.9375rem;line-height:1.4;text-wrap:pretty}
.cf-referral-share-2 .rs2-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@container (max-width: 420px){.cf-referral-share-2 .rs2-share-label.is-social{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}}
.cf-referral-share-2.is-armed .rs2-rv{opacity:0.82;transform:translateY(8px)}
.cf-referral-share-2.is-in .rs2-rv{animation:rs2-rise .45s cubic-bezier(.2,.7,.2,1) backwards;animation-delay:calc(var(--i, 0) * .07s)}
.cf-referral-share-2.is-armed .rs2-fill{transform:scaleX(0)}
.cf-referral-share-2.is-in .rs2-fill{transform:scaleX(1);transition:transform .9s cubic-bezier(.2,.7,.2,1) .25s}
.cf-referral-share-2.is-in .rs2-disc--done{animation:rs2-pop .3s ease .6s backwards}
@keyframes rs2-rise{from{opacity:0.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes rs2-pop{from{transform:scale(0.9)}to{transform:scale(1)}}
@media (max-width: 899px){
.cf-referral-share-2{padding-top:0;background:var(--surface)}
.cf-referral-share-2 .rs2-stripe,.cf-referral-share-2 .rs2-field{display:none}
.cf-referral-share-2 .rs2-wrap{grid-template-columns:minmax(0,1fr);gap:0}
.cf-referral-share-2 .rs2-lead-wrap{margin:0 calc(-1 * var(--rs2-gutter));background:var(--accent-fill, var(--accent));clip-path:polygon(0 0,100% 0,100% calc(100% - 44px),0 100%)}
.cf-referral-share-2 .rs2-lead{padding:clamp(56px,8vw,112px) var(--rs2-gutter) 112px;background:var(--band);clip-path:polygon(0 0,100% 0,100% calc(100% - 58px),0 calc(100% - 14px))}
.cf-referral-share-2 .rs2-card{margin-top:-64px}
.cf-referral-share-2 .rs2-friend img{width:112px}
}
@media (prefers-reduced-motion: reduce){
.cf-referral-share-2 *{animation:none !important;transition:none !important}
.cf-referral-share-2 .rs2-fill,.cf-referral-share-2 .rs2-rv{opacity:1 !important;transform:none !important}
}
`
pieces/checkout/referral-share-2/specimen.tsx 35 lines
import __studioImage1af42422 from "../assets/56c78db6da90f32a.webp";
import * as React from "react"
import defaults from "../../studio-defaults.json"
import { slot } from "../../slots"
import { ReferralShare2 } from "../referral-share-2"
export const states = ["default", "hover", "active", "disabled", "error", "success"] as const
type SpecimenState = (typeof states)[number]
export default function ReferralShare2Specimen({ state = "default" }: { state?: SpecimenState }) {
const sample = defaults.sample
return (
<ReferralShare2
state={state}
reward="$10"
productName={sample.name}
productImage={slot(
"product",
__studioImage1af42422,
)}
productImageAlt={`${sample.name}: planning guide, copy workbook and launch checklist`}
price={sample.price}
regularPrice={sample.regularPrice}
referrals={2}
tiers={[
{ count: 3, reward: "$25 bonus" },
{ count: 5, reward: "Free funnel review call" },
{ count: 10, reward: "$100 bonus" },
]}
link="https://funnelstarterkit.com/r/dana-r"
shareText="I used this to plan my first funnel. Thought you'd want it:"
note="Your $10 is paid once your friend's 30-day money-back window closes."
/>
)
}
| Name | Type | Details |
|---|---|---|
reward RequiredReferralShare2 |
string |
|
link RequiredReferralShare2 |
string |
|
productName OptionalReferralShare2 |
string |
|
productImage OptionalReferralShare2 |
string |
|
productImageAlt OptionalReferralShare2 |
string |
|
price OptionalReferralShare2 |
string |
|
regularPrice OptionalReferralShare2 |
string |
|
referrals OptionalReferralShare2 |
number |
|
tiers OptionalReferralShare2 |
ReferralShare2Tier[] |
|
shareText OptionalReferralShare2 |
string |
|
channels OptionalReferralShare2 |
ReferralShare2Channel[] |
|
note OptionalReferralShare2 |
React.ReactNode |
|
copy OptionalReferralShare2 |
Partial<Omit<ReferralShare2Copy, "channels">> & {
channels?: Partial<Record<ReferralShare2Channel, string>>
} |
|
onCopy OptionalReferralShare2 |
(link: string) => void |
|
onShare OptionalReferralShare2 |
(channel: ReferralShare2Channel, href: string) => void |
|
disabled OptionalReferralShare2 |
boolean |
|
state OptionalReferralShare2 |
"default" | "hover" | "active" | "disabled" | "error" | "success" |
|
className OptionalReferralShare2 |
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.
product- The main product shot or cover (ebook, kit, bottle).
-
56c78db6da90f32a.webp
image/webp · 140 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB