Referral Share 7
Give-and-get referral: what the friend gets beside what you get, joined by the share link bar and a live message preview, so copying or sending the link is the obvious next move.
Use it in a prompt
Use checkout/referral-share-7 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-7.tsx. - Import it and pass your copy and images (Props tab):
import { ReferralShare7 } from "@/components/funneldna/checkout/referral-share-7"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/referral-share-7/component.tsx 559 lines
// layout: before-after-split
// Give-and-get referral: what the friend gets beside what you get, joined by the share link bar and a live message preview, so copying or sending the link is the obvious next move.
import * as React from "react"
import { AtSign, Check, CircleAlert, Copy, Link2, Mail, MessageSquare, Plus, Share2 } from "lucide-react"
import { FX_HOST, Pattern } from "../fx/fx"
export type ReferralShare7Channel = "email" | "sms" | "facebook" | "x"
export type ReferralShare7Reward = {
/** Headline for this half, e.g. "Their first bag is on you". */
title: React.ReactNode
/** What exactly is received and when. */
detail?: React.ReactNode
/** Short flag on the product photo's corner, e.g. "Free bag". */
tag?: string
/** Product photo; a transparent cut-out sits best on both halves. */
image?: string
imageAlt?: string
}
export type ReferralShare7Copy = {
/** Plain instruction above the link bar. */
instruction: string
linkLabel: string
/** Shown in the link bar when no link is supplied. */
noLink: string
copyLabel: string
copiedLabel: string
/** Screen-reader announcement after copying. */
copiedAnnounce: string
copyError: string
messageLabel: string
messagePlaceholder: string
messageHint: string
messageError: string
/** Character counter; {count} and {max} are replaced. */
counter: string
previewLabel: string
/** Stands in for the link inside the preview when none is supplied. */
previewNoLink: string
shareLead: string
shareNoLink: string
emailSubject: string
channels: Record<ReferralShare7Channel, string>
}
export type ReferralShare7Props = {
headline?: React.ReactNode
lead?: React.ReactNode
/** Italic aside in the founder's voice under the lead. */
aside?: React.ReactNode
/** What the friend gets: the colour-blocked half, shown first on phones. */
friend: ReferralShare7Reward
/** What the customer gets. */
you: ReferralShare7Reward
/** The customer's personal referral link; copy and share stay off without it. */
link?: string
/** Starting share message; the link is always appended after it. */
message?: string
maxLength?: number
channels?: ReferralShare7Channel[]
/** Terms line under the share buttons (supplied terms only). */
note?: React.ReactNode
copy?: Partial<Omit<ReferralShare7Copy, "channels">> & {
channels?: Partial<Record<ReferralShare7Channel, string>>
}
/** Called after the link is copied. */
onCopy?: (link: string) => void
/** Called when a share button is clicked, before the share opens. */
onShare?: (channel: ReferralShare7Channel, href: string, text: string) => void
onMessageChange?: (message: string) => void
state?: "default" | "hover" | "active" | "disabled" | "error" | "success"
className?: string
}
export function ReferralShare7(props: ReferralShare7Props) {
const {
headline = DEFAULT_HEADLINE,
lead = "Send your link to someone who’d love this. When they order, you’re both rewarded.",
aside = "(Yes, both of you. No catch.)",
friend,
you,
link = "",
message: startMessage = "I’ve been loving this and thought of you. Here’s a gift for your first order:",
maxLength = 240,
channels = ["email", "sms", "facebook", "x"],
note,
onCopy,
onShare,
onMessageChange,
state = "default",
className,
} = props
const copy: ReferralShare7Copy = {
...DEFAULT_COPY,
...(props.copy || {}),
channels: { ...DEFAULT_COPY.channels, ...((props.copy && props.copy.channels) || {}) },
}
const uid = React.useId().replace(/:/g, "")
const headId = `rs7${uid}-head`
const instructId = `rs7${uid}-instruct`
const msgId = `rs7${uid}-msg`
const hintId = `rs7${uid}-hint`
const errId = `rs7${uid}-err`
const noLinkId = `rs7${uid}-nolink`
const cleanLink = link.trim()
const linkReady = cleanLink !== "" && state !== "disabled"
const [message, setMessage] = React.useState(state === "error" ? "" : startMessage)
const [touched, setTouched] = React.useState(false)
const [status, setStatus] = React.useState<"idle" | "copied" | "error">("idle")
const timer = React.useRef<number | null>(null)
const linkRef = React.useRef<HTMLSpanElement>(null)
const copyRef = React.useRef<HTMLButtonElement>(null)
React.useEffect(() => {
setMessage(state === "error" ? "" : startMessage)
setTouched(false)
setStatus("idle")
}, [state, startMessage])
React.useEffect(() => {
return () => {
if (timer.current !== null) window.clearTimeout(timer.current)
}
}, [])
const trimmed = message.trim()
const showError = trimmed === "" && (touched || state === "error")
const canShare = linkReady && trimmed !== ""
const shareText = trimmed ? `${trimmed} ${cleanLink}` : cleanLink
const copied = linkReady && (state === "success" || status === "copied")
const copyFailed = linkReady && status === "error"
const copyClass = [
"rs7-copy",
state === "hover" ? "is-hover" : "",
state === "active" ? "is-active" : "",
copied ? "is-copied" : "",
]
.filter(Boolean)
.join(" ")
const shareDescribedBy = !linkReady ? noLinkId : showError ? errId : undefined
async function handleCopy() {
if (!linkReady) return
let ok = false
try {
if (typeof navigator !== "undefined" && navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(cleanLink)
ok = true
}
} catch {
ok = false
}
if (!ok) ok = legacyCopy(cleanLink, copyRef.current)
if (timer.current !== null) window.clearTimeout(timer.current)
if (ok) {
setStatus("copied")
if (onCopy) onCopy(cleanLink)
timer.current = window.setTimeout(() => setStatus("idle"), 2000)
} else {
setStatus("error")
selectText(linkRef.current)
}
}
function handleMessage(event: React.ChangeEvent<HTMLTextAreaElement>) {
const value = event.target.value
setMessage(value)
if (onMessageChange) onMessageChange(value)
}
return (
<section
className={["cf-referral-share-7", className].filter(Boolean).join(" ")}
style={FX_HOST}
aria-labelledby={headId}
data-state={state}
>
<style>{CSS}</style>
<Pattern name="rings" fade="top" />
<div className="rs7-inner">
<header className="rs7-head rs7-reveal">
<h2 id={headId} className="rs7-h2">
{headline}
</h2>
{lead ? <p className="rs7-lead">{lead}</p> : null}
{aside ? <p className="rs7-aside">{aside}</p> : null}
</header>
<div className="rs7-panel">
<div className="rs7-split">
<RewardHalf side="friend" reward={friend} />
<RewardHalf side="you" reward={you} />
</div>
<div className="rs7-bar">
<p id={instructId} className="rs7-instruct">
{copy.instruction}
</p>
<div className={linkReady ? "rs7-well" : "rs7-well is-empty"}>
<Link2 className="rs7-well-icon" size={20} strokeWidth={2.5} aria-hidden />
<div className="rs7-linkbox">
<span className="rs7-linklabel">{copy.linkLabel}</span>
<span ref={linkRef} className="rs7-link">
{linkReady ? breakable(cleanLink) : copy.noLink}
</span>
</div>
<button
ref={copyRef}
type="button"
className={copyClass}
onClick={handleCopy}
disabled={!linkReady}
aria-describedby={instructId}
>
{copied ? (
<Check size={20} strokeWidth={2.5} aria-hidden />
) : (
<Copy size={20} strokeWidth={2.5} aria-hidden />
)}
<span>{copied ? copy.copiedLabel : copy.copyLabel}</span>
</button>
</div>
{copyFailed ? (
<p className="rs7-error" role="alert">
<CircleAlert className="rs7-inline-icon" size={16} strokeWidth={2.5} aria-hidden />
{copy.copyError}
</p>
) : null}
<p className="rs7-sr" role="status" aria-live="polite">
{copied ? copy.copiedAnnounce : ""}
</p>
<div className="rs7-compose">
<div className="rs7-field">
<label htmlFor={msgId} className="rs7-label">
{copy.messageLabel}
</label>
<textarea
id={msgId}
className={showError ? "rs7-textarea is-invalid" : "rs7-textarea"}
value={message}
onChange={handleMessage}
onBlur={() => setTouched(true)}
placeholder={copy.messagePlaceholder}
maxLength={maxLength}
rows={4}
aria-invalid={showError || undefined}
aria-describedby={showError ? `${errId} ${hintId}` : hintId}
/>
<div className="rs7-meta">
<span id={hintId}>{copy.messageHint}</span>
<span className={message.length >= maxLength - 20 ? "rs7-count is-near" : "rs7-count"}>
{fill(copy.counter, { count: String(message.length), max: String(maxLength) })}
</span>
</div>
{showError ? (
<p id={errId} className="rs7-error">
<CircleAlert className="rs7-inline-icon" size={16} strokeWidth={2.5} aria-hidden />
{copy.messageError}
</p>
) : null}
</div>
<div className="rs7-preview">
<p className="rs7-label">{copy.previewLabel}</p>
<div className="rs7-pwell">
<p className="rs7-bubble">
{trimmed ? <span className="rs7-bubble-text">{trimmed}</span> : null}
<span className={linkReady ? "rs7-bubble-link" : "rs7-bubble-link is-empty"}>
{linkReady ? breakable(cleanLink) : copy.previewNoLink}
</span>
</p>
</div>
</div>
</div>
{channels.length ? (
<div className="rs7-sharewrap">
<p className="rs7-label">{copy.shareLead}</p>
<ul className="rs7-shares" role="list">
{channels.map((ch) => {
const Icon = ICONS[ch]
const label = copy.channels[ch]
if (!canShare) {
return (
<li key={ch}>
<button type="button" className="rs7-share" disabled aria-describedby={shareDescribedBy}>
<Icon size={20} strokeWidth={2.5} aria-hidden />
<span>{label}</span>
</button>
</li>
)
}
const href = shareHref(ch, shareText, trimmed, cleanLink, copy.emailSubject)
const external = ch === "facebook" || ch === "x"
return (
<li key={ch}>
<a
className="rs7-share"
href={href}
target={external ? "_blank" : undefined}
rel={external ? "noopener noreferrer" : undefined}
onClick={() => {
if (onShare) onShare(ch, href, shareText)
}}
>
<Icon size={20} strokeWidth={2.5} aria-hidden />
<span>{label}</span>
</a>
</li>
)
})}
</ul>
{!linkReady ? (
<p id={noLinkId} className="rs7-small">
{copy.shareNoLink}
</p>
) : null}
</div>
) : null}
{note ? <p className="rs7-note">{note}</p> : null}
</div>
</div>
</div>
</section>
)
}
export default ReferralShare7
function RewardHalf({ side, reward }: { side: "friend" | "you"; reward: ReferralShare7Reward }) {
return (
<div
className={`rs7-half rs7-half--${side} rs7-reveal`}
style={{ "--d": side === "you" ? ".14s" : ".07s" } as React.CSSProperties}
>
{side === "you" ? (
<span className="rs7-seam" aria-hidden="true">
<span className="rs7-seam-in">
<Plus size={24} strokeWidth={2.5} />
</span>
</span>
) : null}
{reward.image ? (
<div className="rs7-figure">
<img src={reward.image} alt={reward.imageAlt || ""} width={320} height={320} loading="lazy" decoding="async" />
{reward.tag ? <span className="rs7-tag">{reward.tag}</span> : null}
</div>
) : reward.tag ? (
<span className="rs7-tag rs7-tag--solo">{reward.tag}</span>
) : null}
<h3 className="rs7-h3">{reward.title}</h3>
{reward.detail ? <p className="rs7-detail">{reward.detail}</p> : null}
</div>
)
}
const ICONS = { email: Mail, sms: MessageSquare, facebook: Share2, x: AtSign }
function shareHref(ch: ReferralShare7Channel, text: string, message: string, link: string, subject: string) {
switch (ch) {
case "email":
return `mailto:?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(text)}`
case "sms":
return `sms:?&body=${encodeURIComponent(text)}`
case "facebook":
return `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}"e=${encodeURIComponent(message)}`
default:
return `https://x.com/intent/post?text=${encodeURIComponent(text)}`
}
}
function fill(template: string, vars: Record<string, string>) {
return Object.keys(vars).reduce((out, key) => out.split("{" + key + "}").join(vars[key]), template)
}
/** Adds line-break opportunities after single slashes so a long link wraps at its path, never mid-word. */
function breakable(url: string): React.ReactNode[] {
const out: React.ReactNode[] = []
let buf = ""
for (let i = 0; i < url.length; i++) {
buf += url[i]
if (url[i] === "/" && url[i - 1] !== "/" && url[i + 1] !== "/" && i < url.length - 1) {
out.push(buf, <wbr key={i} />)
buf = ""
}
}
if (buf) out.push(buf)
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)
if (restore) restore.focus()
return ok
}
function selectText(el: HTMLElement | null) {
if (!el || typeof window === "undefined" || !window.getSelection) return
const range = document.createRange()
range.selectNodeContents(el)
const selection = window.getSelection()
if (!selection) return
selection.removeAllRanges()
selection.addRange(range)
}
const DEFAULT_HEADLINE = (
<>
Give a friend a gift. <mark>Get one back.</mark>
</>
)
const DEFAULT_COPY: ReferralShare7Copy = {
instruction: "Copy your link below, then send it to one friend today.",
linkLabel: "Your personal link",
noLink: "Your personal link will appear here as soon as it’s ready.",
copyLabel: "Copy link",
copiedLabel: "Copied",
copiedAnnounce: "Your link is copied. Paste it anywhere to share.",
copyError: "We couldn’t copy it automatically. The link is selected, so press Ctrl+C or ⌘C.",
messageLabel: "Write your message",
messagePlaceholder: "Hey! I think you’d love this. Here’s a gift for your first order:",
messageHint: "Your link is added to the end.",
messageError: "Add a few words so your friend knows it’s from you.",
counter: "{count}/{max}",
previewLabel: "What your friend will see",
previewNoLink: "Your link goes here",
shareLead: "Or send it straight from here",
shareNoLink: "Sharing turns on as soon as your link is ready.",
emailSubject: "A gift for you",
channels: { email: "Email", sms: "Text", facebook: "Facebook", x: "Post on X" },
}
const R = ".cf-referral-share-7"
const CSS = `
${R}{--rs7-marker:color-mix(in oklch,var(--marker,#fae37c) 80%,transparent);position:relative;isolation:isolate;overflow:hidden;background:var(--surface);color:var(--ink);font-family:var(--font-body);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px)}
${R} *,${R} *::before,${R} *::after{box-sizing:border-box}
${R} .rs7-inner{position:relative;z-index:1;max-width:1120px;margin:0 auto}
${R} .rs7-head{max-width:46rem;margin:0 auto clamp(32px,4vw,48px);text-align:center}
${R} .rs7-h2{margin:0 0 16px;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(--ink)}
${R} .rs7-h2 mark{color:inherit;background:linear-gradient(to bottom,transparent 56%,var(--rs7-marker) 56%,var(--rs7-marker) 93%,transparent 93%);padding:0 .08em;margin:0 -.04em;border-radius:.12em;-webkit-box-decoration-break:clone;box-decoration-break:clone}
${R} .rs7-lead{margin:0 auto;max-width:40rem;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
${R} .rs7-aside{margin:12px auto 0;max-width:40rem;font-style:italic;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--ink);text-wrap:pretty}
${R} .rs7-panel{background:var(--card);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .22),0 12px 24px -8px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .32)));overflow:hidden}
${R} .rs7-split{display:grid;grid-template-columns:1fr 1fr}
${R} .rs7-half{position:relative;display:flex;flex-direction:column;align-items:center;text-align:center;padding:clamp(28px,3.6vw,44px) clamp(32px,4vw,56px) clamp(32px,4vw,48px)}
${R} .rs7-half--friend{background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));box-shadow:inset 0 1px 0 oklch(from var(--accent-fill,var(--accent)) calc(l + 0.08) c h / .6)}
${R} .rs7-half--you{background:var(--card);color:var(--ink)}
${R} .rs7-seam{position:absolute;z-index:2;top:50%;left:0;width:56px;height:56px;transform:translate(-50%,-50%)}
${R} .rs7-seam-in{display:grid;place-items:center;width:100%;height:100%;border-radius:999px;background:var(--card);color:var(--accent);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));box-shadow:var(--shadow-md,0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .22),0 4px 10px -2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .2))}
${R} .rs7-figure{position:relative;width:min(100%,280px);height:clamp(180px,21vw,250px);margin:0 auto 20px}
${R} .rs7-figure img{display:block;width:100%;height:100%;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 2px 3px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .35)) drop-shadow(0 14px 16px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .28))}
${R} .rs7-tag{position:absolute;top:4px;right:-6px;display:inline-flex;align-items:center;min-height:30px;padding:4px 12px;border-radius:999px;font-size:.875rem;font-weight:800;line-height:1.2;white-space:nowrap;box-shadow:var(--shadow-sm,0 1px 1px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .18),0 1px 3px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .14))}
${R} .rs7-half--friend .rs7-tag{background:var(--card);color:var(--ink)}
${R} .rs7-half--you .rs7-tag{background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card))}
${R} .rs7-tag--solo{position:static;margin-bottom:16px}
${R} .rs7-h3{margin:0 0 12px;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:inherit}
${R} .rs7-detail{margin:0;max-width:34ch;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
${R} .rs7-half--friend .rs7-detail{color:var(--accent-fill-ink,var(--card))}
${R} .rs7-half--you .rs7-detail{color:var(--muted)}
${R} .rs7-bar{display:grid;gap:24px;padding:clamp(24px,3.4vw,40px) clamp(20px,3.6vw,48px) clamp(24px,3.6vw,44px);border-top:1px solid oklch(from var(--ink) l c h / .1)}
${R} .rs7-instruct{margin:0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;font-weight:700;color:var(--ink);text-wrap:pretty}
${R} .rs7-well{display:flex;align-items:center;gap:16px;padding:10px 10px 10px 20px;border-radius:12px;background:color-mix(in oklch,var(--ink) 5%,var(--card));margin-top:-12px}
${R} .rs7-well-icon{flex:none;color:var(--accent)}
${R} .rs7-linkbox{flex:1;min-width:0;display:grid;gap:4px}
${R} .rs7-linklabel{font-size:.875rem;font-weight:800;line-height:1.2;color:var(--muted)}
${R} .rs7-link{font-size:1.0625rem;font-weight:700;line-height:1.35;color:var(--ink);overflow-wrap:break-word;-webkit-user-select:all;user-select:all}
${R} .rs7-well.is-empty .rs7-link{color:var(--muted);font-weight:500;-webkit-user-select:auto;user-select:auto}
${R} .rs7-copy{flex:none;min-height:56px;min-width:10.5rem;padding:0 24px;display:inline-flex;align-items:center;justify-content:center;gap:8px;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;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 / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .3),0 8px 16px -6px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .45));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
${R} .rs7-copy:hover:not(:disabled),${R} .rs7-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.1) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.2) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .32),0 10px 18px -6px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .55))}
${R} .rs7-copy:active:not(:disabled),${R} .rs7-copy.is-active{transform:translateY(1px);background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - 0.06) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.1) c h));box-shadow:inset 0 2px 4px oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.2) c h / .55),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .3)}
${R} .rs7-copy:disabled{cursor:not-allowed;background:var(--secondary);color:color-mix(in oklch,var(--secondary-ink) 62%,var(--secondary));text-shadow:none;box-shadow:none}
${R} .rs7-copy svg,${R} .rs7-share svg{flex:none}
${R} .rs7-compose{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:start}
${R} .rs7-field,${R} .rs7-preview{display:grid;gap:8px;min-width:0}
${R} .rs7-label{margin:0;font-size:1rem;font-weight:700;line-height:1.3;color:var(--label-ink,var(--ink))}
${R} .rs7-textarea{display:block;width:100%;min-height:148px;padding:14px 16px;resize:vertical;font:inherit;font-size:1.0625rem;line-height:1.5;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));transition:border-color .16s ease,box-shadow .16s ease}
${R} .rs7-textarea::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
${R} .rs7-textarea:hover{border-color:color-mix(in oklch,var(--ink) 38%,transparent)}
${R} .rs7-textarea: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 / .35)}
${R} .rs7-textarea.is-invalid{border-color:var(--danger)}
${R} .rs7-textarea.is-invalid:focus{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / .3)}
${R} .rs7-meta{display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px 12px;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted)}
${R} .rs7-count{font-variant-numeric:tabular-nums;white-space:nowrap;margin-inline-start:auto}
${R} .rs7-count.is-near{color:var(--warning);font-weight:700}
${R} .rs7-error{margin:0;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--danger);text-wrap:pretty}
${R} .rs7-inline-icon{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em}
${R} .rs7-pwell{display:flex;flex-direction:column;justify-content:flex-end;min-height:148px;padding:20px;border-radius:12px;background:color-mix(in oklch,var(--ink) 5%,var(--card))}
${R} .rs7-bubble{align-self:flex-end;max-width:min(100%,26rem);margin:0;padding:14px 18px;border-radius:20px 20px 6px 20px;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));font-size:1.0625rem;line-height:1.5;overflow-wrap:break-word;box-shadow:var(--shadow-sm,0 1px 1px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .18),0 1px 3px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .14))}
${R} .rs7-bubble-text{display:block;white-space:pre-wrap}
${R} .rs7-bubble-link{display:block;font-weight:700;text-decoration:underline;text-decoration-thickness:1.5px;text-underline-offset:.18em}
${R} .rs7-bubble-text + .rs7-bubble-link{margin-top:8px}
${R} .rs7-bubble-link.is-empty{font-weight:500;font-style:italic;text-decoration:none}
${R} .rs7-sharewrap{display:grid;gap:12px}
${R} .rs7-shares{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
${R} .rs7-shares > li{display:flex;min-width:0}
${R} .rs7-share{flex:1;min-width:0;min-height:56px;padding:0 16px;display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:var(--button-radius,var(--radius,12px));border:1px solid var(--button-2-border,transparent);background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 1px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .18),0 1px 3px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .14)));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;text-decoration:none;white-space:nowrap;cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
${R} a.rs7-share:hover{background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - 0.04) c h);border-color:oklch(from var(--button-2-ink,var(--secondary-ink)) l c h / .28);transform:translateY(-1px);box-shadow:var(--shadow-md,0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .22),0 4px 10px -2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .2))}
${R} a.rs7-share:active{transform:translateY(1px);background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - 0.07) c h);box-shadow:inset 0 2px 3px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .18)}
${R} .rs7-share:disabled{cursor:not-allowed;background:var(--secondary);border-color:transparent;color:color-mix(in oklch,var(--secondary-ink) 62%,var(--secondary));box-shadow:none}
${R} .rs7-copy:focus-visible,${R} .rs7-share:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / .6);outline-offset:3px}
${R} .rs7-small,${R} .rs7-note{margin:0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
${R} .rs7-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@media (prefers-reduced-motion:no-preference){
${R} .rs7-reveal{animation:rs7-rise .45s cubic-bezier(.2,.7,.2,1) var(--d,0s) both}
${R} .rs7-seam-in,${R} .rs7-tag{animation:rs7-pop .3s cubic-bezier(.2,.7,.2,1) .28s both}
${R} .rs7-copy.is-copied svg{animation:rs7-pop .3s cubic-bezier(.2,.7,.2,1) both}
}
@media (prefers-reduced-motion:reduce){
${R} .rs7-copy,${R} .rs7-share,${R} .rs7-textarea{transition:none}
${R} a.rs7-share:hover,${R} a.rs7-share:active,${R} .rs7-copy:active:not(:disabled),${R} .rs7-copy.is-active{transform:none}
}
@keyframes rs7-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes rs7-pop{from{transform:scale(.9)}to{transform:scale(1)}}
@media (max-width:760px){
${R} .rs7-split{grid-template-columns:1fr}
${R} .rs7-half--friend{padding-bottom:52px}
${R} .rs7-half--you{padding-top:52px}
${R} .rs7-seam{top:0;left:50%}
${R} .rs7-compose{grid-template-columns:1fr}
${R} .rs7-pwell{min-height:0;padding:16px}
${R} .rs7-bubble{max-width:100%}
}
@media (max-width:640px){
${R} .rs7-shares{grid-template-columns:repeat(2,minmax(0,1fr))}
${R} .rs7-share{padding:0 12px}
}
@media (max-width:560px){
${R} .rs7-well{flex-wrap:wrap;padding:16px;gap:12px 16px}
${R} .rs7-linkbox{flex-basis:calc(100% - 36px)}
${R} .rs7-copy{width:100%}
}
@media (max-width:400px){
${R} .rs7-share{font-size:1.0625rem;gap:6px}
}
`
pieces/checkout/referral-share-7/specimen.tsx 46 lines
import __studioImagec6ef47ee from "../assets/092dd85fc448a59a.webp";
import __studioImage3ccc7ee5 from "../assets/9ebce2f1dc4e4642.webp";
import * as React from "react"
import { ReferralShare7, type ReferralShare7Props } from "../referral-share-7"
import { slot } from "../../slots"
export const states = ["default", "hover", "active", "disabled", "error", "success"]
export default function ReferralShare7Specimen({ state }: { state?: ReferralShare7Props["state"] }) {
return (
<ReferralShare7
state={state}
headline={
<>
Give a friend a free bag. <mark>Get one back.</mark>
</>
}
lead="Send Lowtide Coffee to someone who’d love it. When they start a subscription with your link, you both get a bag on us."
aside="(Yes, both of you. I wanted this one to be simple.)"
friend={{
title: "Their first bag is on you",
detail: "A free 12oz bag of any roast when they start a Lowtide subscription with your link.",
tag: "Free bag",
image: slot(
"item-1",
__studioImagec6ef47ee
),
imageAlt: "A bag of Lowtide Coffee with roasted beans",
}}
you={{
title: "And your next bag is on them",
detail: "We add a free 12oz bag to your next delivery once their first order ships.",
tag: "Free bag",
image: slot(
"item-2",
__studioImage3ccc7ee5
),
imageAlt: "A bag of Lowtide Coffee beside a mug of black coffee",
}}
link={state === "disabled" ? "" : "https://lowtide.coffee/r/jordan-k7"}
message="I’ve been drinking Lowtide every morning and I think you’d love it. Your first bag is free with my link:"
note="One free bag per friend who starts a subscription. Your bag is added after their first order ships."
copy={{ emailSubject: "A free bag of Lowtide Coffee for you" }}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalReferralShare7 |
React.ReactNode |
|
lead OptionalReferralShare7 |
React.ReactNode |
|
aside OptionalReferralShare7 |
React.ReactNode |
|
friend RequiredReferralShare7 |
ReferralShare7Reward |
|
you RequiredReferralShare7 |
ReferralShare7Reward |
|
link OptionalReferralShare7 |
string |
|
message OptionalReferralShare7 |
string |
|
maxLength OptionalReferralShare7 |
number |
|
channels OptionalReferralShare7 |
ReferralShare7Channel[] |
|
note OptionalReferralShare7 |
React.ReactNode |
|
copy OptionalReferralShare7 |
Partial<Omit<ReferralShare7Copy, "channels">> & {
channels?: Partial<Record<ReferralShare7Channel, string>>
} |
|
onCopy OptionalReferralShare7 |
(link: string) => void |
|
onShare OptionalReferralShare7 |
(channel: ReferralShare7Channel, href: string, text: string) => void |
|
onMessageChange OptionalReferralShare7 |
(message: string) => void |
|
state OptionalReferralShare7 |
"default" | "hover" | "active" | "disabled" | "error" | "success" |
|
className OptionalReferralShare7 |
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.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-1- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-2- One image per offer item (item-1, item-2…), shown in stacks and lists.
-
092dd85fc448a59a.webp
image/webp · 98.6 KB
-
9ebce2f1dc4e4642.webp
image/webp · 93.5 KB