Referral Rewards 1
Referral reward staircase: the value ladder applied to sharing. Reached rewards light up, the next one shows exactly how
Use it in a prompt
Use content/referral-rewards from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/content/referral-rewards.tsx. - Import it and pass your copy and images (Props tab):
import { ReferralRewards } from "@/components/funneldna/content/referral-rewards"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/referral-rewards/component.tsx 560 lines
// layout: diagonal-split
// Referral reward staircase: the value ladder applied to sharing. Reached rewards light up, the next one shows exactly how
// many friends are left, a tap opens each reward's details, and the block ends on the invite link with copy and share.
import React, { useEffect, useId, useRef, useState } from 'react';
import { AlertCircle, Check, Copy, Flag, Link2, Lock, MousePointerClick, Share2 } from 'lucide-react';
export type ReferralReward = {
/** Friends who must join with the member’s link to unlock this reward. */
friends: number;
title: string;
detail?: React.ReactNode;
/** Short lines listed under the detail with a tick. */
perks?: string[];
/** Reward image (slot item-n): a cut-out on a transparent background. */
image?: string;
imageAlt?: string;
};
const DEFAULT_COPY = {
friend: 'friend',
friends: 'friends',
countOne: 'friend joined with your link',
countMany: 'friends joined with your link',
/** {Remaining} = capitalised number word, {remaining} = number word, {unit} = friend/friends, {reward} = reward title. */
nextLine: '{Remaining} more to the next reward: {reward}.',
firstLine: '{Remaining} {unit} to your first reward: {reward}.',
allLine: 'You’ve unlocked every reward on the stairs. Keep sharing.',
hint: 'Tap any step to see what you get.',
tagReached: 'Unlocked',
tagNext: 'Next reward',
tagFirst: 'Your first goal',
tagLocked: 'Locked',
/** {count} = member’s referrals, {friends} = the step’s target. */
progress: '{count} of {friends} joined',
tier: 'Refer {friends} {unit}',
statusReached: 'Unlocked. This one is yours.',
statusLocked: '{Remaining} more {unit} to unlock this reward.',
shareHeading: 'Share your link, climb a step',
shareBody: 'Every writer who joins with your link counts toward your next reward. Copy your link below and send it to one writer today.',
linkLabel: 'Your invite link',
linkPlaceholder: 'yoursite.com/r/your-name',
copyLabel: 'Copy link',
copiedLabel: 'Copied',
shareLabel: 'Share',
copyError: 'We couldn’t copy it for you. Select the link and press Ctrl+C (⌘C on a Mac).',
numbers: ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'],
};
export type ReferralRewardsCopy = typeof DEFAULT_COPY;
export type ReferralRewardsProps = {
headline?: React.ReactNode;
lead?: React.ReactNode;
/** The member’s confirmed referral count. 0 shows the first step as the goal. */
count?: number;
/** Reward tiers; sorted by friends, rising left to right. */
rewards?: ReferralReward[];
/** The member’s invite link as it should be shown and copied. Empty disables copy and share. */
link?: string;
/** One short line under the buttons (programme rule), shown only when supplied. */
note?: string;
shareTitle?: string;
shareText?: string;
copy?: Partial<ReferralRewardsCopy>;
disabled?: boolean;
state?: 'default' | 'hover' | 'active' | 'disabled' | 'error';
onCopy?: (link: string) => void;
/** Replaces the device share sheet when supplied. */
onShare?: (link: string) => void;
onStepSelect?: (reward: ReferralReward, index: number) => void;
className?: string;
};
const DEFAULT_HEADLINE = (
<>
Bring a writer in. <mark>Climb to your next reward.</mark>
</>
);
const DEFAULT_REWARDS: ReferralReward[] = [
{
friends: 1,
title: 'Margin Notes sticker pack',
detail: 'Twelve die-cut vinyl stickers for your laptop and notebook, mailed to your door.',
},
{
friends: 3,
title: 'Swipe File template bundle',
detail: 'Fill-in templates for hooks, emails and sales pages, ready to duplicate into your own docs.',
},
{
friends: 5,
title: '1:1 draft review',
detail: 'A live session with an editor, line by line, on one piece you’re writing now.',
},
];
export function ReferralRewards(props: ReferralRewardsProps) {
const {
headline = DEFAULT_HEADLINE,
lead = 'Every friend who joins with your link moves you up a step. Reach a step and its reward is yours.',
count: rawCount = 0,
rewards = DEFAULT_REWARDS,
link = '',
note,
shareTitle,
shareText,
disabled = false,
state = 'default',
onCopy,
onShare,
onStepSelect,
className,
} = props;
const copy: ReferralRewardsCopy = { ...DEFAULT_COPY, ...props.copy };
const uid = useId();
const headId = uid + 'h';
const panelId = uid + 'p';
const panelTitleId = uid + 'pt';
const inputId = uid + 'i';
const errId = uid + 'e';
const tiers = rewards.filter((r) => r && r.friends > 0).sort((a, b) => a.friends - b.friends);
const n = tiers.length;
const count = Math.max(0, Math.floor(Number.isFinite(rawCount) ? rawCount : 0));
const nextIdx = tiers.findIndex((t) => t.friends > count);
const allDone = nextIdx === -1;
const currentIdx = allDone ? Math.max(n - 1, 0) : nextIdx;
const [selected, setSelected] = useState(currentIdx);
const [copyState, setCopyState] = useState<'idle' | 'copied' | 'error'>(state === 'error' ? 'error' : 'idle');
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
const inputRef = useRef<HTMLInputElement>(null);
const panelRef = useRef<HTMLDivElement>(null);
useEffect(() => {
setSelected(currentIdx);
}, [currentIdx]);
useEffect(() => {
setCopyState(state === 'error' ? 'error' : 'idle');
}, [state]);
useEffect(() => {
return () => {
if (timer.current) clearTimeout(timer.current);
};
}, []);
if (n === 0) return null;
const sel = Math.min(Math.max(selected, 0), n - 1);
const isDisabled = disabled || state === 'disabled' || !link;
const forced = state === 'hover' ? ' is-hover' : state === 'active' ? ' is-active' : '';
const rise = n > 1 ? Math.min(64, Math.round(192 / (n - 1))) : 0;
const unitFor = (k: number) => (k === 1 ? copy.friend : copy.friends);
const word = (k: number) => copy.numbers[k] ?? String(k);
const cap = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);
const next = allDone ? null : tiers[nextIdx];
const remaining = next ? next.friends - count : 0;
const statusLine = next
? fill(nextIdx === 0 ? copy.firstLine : copy.nextLine, {
Remaining: cap(word(remaining)),
remaining: word(remaining),
unit: unitFor(remaining),
reward: next.title,
})
: copy.allLine;
const flash = (value: 'idle' | 'copied' | 'error') => {
if (timer.current) clearTimeout(timer.current);
setCopyState(value);
if (value === 'copied') timer.current = setTimeout(() => setCopyState('idle'), 2200);
};
const handleCopy = async () => {
if (isDisabled) return;
onCopy?.(link);
try {
if (typeof navigator === 'undefined' || !navigator.clipboard) throw new Error('clipboard unavailable');
await navigator.clipboard.writeText(link);
flash('copied');
} catch {
flash('error');
inputRef.current?.focus();
inputRef.current?.select();
}
};
const handleShare = () => {
if (isDisabled) return;
if (onShare) {
onShare(link);
return;
}
const url = /^https?:/i.test(link) ? link : 'https://' + link;
if (typeof navigator !== 'undefined' && typeof navigator.share === 'function') {
navigator.share({ title: shareTitle, text: shareText, url }).catch(() => undefined);
return;
}
void handleCopy();
};
const choose = (i: number) => {
setSelected(i);
onStepSelect?.(tiers[i], i);
if (typeof window !== 'undefined' && window.matchMedia && window.matchMedia('(max-width: 760px)').matches) {
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
window.requestAnimationFrame(() =>
panelRef.current?.scrollIntoView({ block: 'nearest', behavior: reduce ? 'auto' : 'smooth' }),
);
}
};
const st = tiers[sel];
const stReached = st.friends <= count;
const stRemaining = st.friends - count;
const copied = copyState === 'copied';
return (
<section className={['cf-referral-rewards', className].filter(Boolean).join(' ')} aria-labelledby={headId}>
<style>{CSS}</style>
<div className='rr-wrap rr-head'>
<div>
<h2 id={headId} className='rr-h2'>
{headline}
</h2>
{lead ? <p className='rr-lead'>{lead}</p> : null}
</div>
<div className='rr-tally'>
<p className='rr-count'>
<span className='rr-big'>{count}</span>
<span className='rr-count-label'>{count === 1 ? copy.countOne : copy.countMany}</span>
</p>
<p className='rr-next' aria-live='polite'>
{statusLine}
</p>
{n > 1 && copy.hint ? (
<p className='rr-hint'>
<MousePointerClick className='rr-inline-ic' size={16} strokeWidth={2.5} aria-hidden='true' />
{copy.hint}
</p>
) : null}
</div>
</div>
<div className='rr-stage'>
<div className='rr-field' aria-hidden='true' />
<div className='rr-wrap'>
<ol
className='rr-stairs'
style={{ ['--rr-n' as string]: n, ['--rr-rise' as string]: rise + 'px' } as React.CSSProperties}
>
{tiers.map((t, i) => {
const reached = t.friends <= count;
const isNext = i === nextIdx;
const stepState = reached ? 'reached' : isNext ? 'next' : 'locked';
const isSel = i === sel;
const tag = reached ? copy.tagReached : isNext ? (nextIdx === 0 ? copy.tagFirst : copy.tagNext) : copy.tagLocked;
const pct = Math.min(100, Math.round((count / t.friends) * 100));
return (
<li
key={t.friends + '-' + i}
className={'rr-step' + (isSel ? ' is-selected' : '') + (t.image ? '' : ' no-art')}
data-state={stepState}
style={{ ['--i' as string]: i } as React.CSSProperties}
>
<button
type='button'
className='rr-stepbtn'
aria-pressed={isSel}
aria-controls={panelId}
aria-current={i === currentIdx ? 'step' : undefined}
onClick={() => choose(i)}
>
<span className='rr-art'>{t.image ? <img src={t.image} alt='' decoding='async' /> : null}</span>
<span className='rr-tread'>
<span className='rr-badge' aria-hidden='true'>
{reached ? (
<Check size={18} strokeWidth={3} />
) : isNext ? (
<Flag size={16} strokeWidth={2.5} />
) : (
<Lock size={16} strokeWidth={2.5} />
)}
</span>
<span className='rr-numrow'>
<span className='rr-num'>{t.friends}</span>
<span className='rr-unit'>{unitFor(t.friends)}</span>
</span>
<span className='rr-title'>{t.title}</span>
<span className='rr-foot'>
{isNext ? (
<span className='rr-meter-wrap'>
<span className='rr-meter' aria-hidden='true'>
<span style={{ width: pct + '%' }} />
</span>
<span className='rr-meter-label'>{fill(copy.progress, { count, friends: t.friends })}</span>
</span>
) : null}
<span className='rr-tag'>{tag}</span>
</span>
</span>
</button>
</li>
);
})}
</ol>
<div className='rr-lower'>
<div
ref={panelRef}
id={panelId}
className='rr-card rr-panel'
role='region'
aria-live='polite'
aria-labelledby={panelTitleId}
>
<div key={sel} className={'rr-panel-in' + (st.image ? '' : ' no-art')}>
{st.image ? (
<div className='rr-panel-art'>
<img src={st.image} alt={st.imageAlt || st.title} decoding='async' />
</div>
) : null}
<div>
<p className='rr-tier'>{fill(copy.tier, { friends: st.friends, unit: unitFor(st.friends) })}</p>
<h3 id={panelTitleId} className='rr-h3'>
{st.title}
</h3>
{st.detail ? <p className='rr-body'>{st.detail}</p> : null}
{st.perks && st.perks.length ? (
<ul className='rr-perks'>
{st.perks.map((perk) => (
<li key={perk}>
<Check size={18} strokeWidth={2.5} aria-hidden='true' />
<span>{perk}</span>
</li>
))}
</ul>
) : null}
<p className={'rr-status' + (stReached ? ' is-reached' : '')}>
{stReached ? (
<span className='rr-status-badge' aria-hidden='true'>
<Check size={16} strokeWidth={3} />
</span>
) : (
<Lock className='rr-status-lock' size={18} strokeWidth={2.5} aria-hidden='true' />
)}
<span>
{stReached
? copy.statusReached
: fill(copy.statusLocked, {
Remaining: cap(word(stRemaining)),
remaining: word(stRemaining),
unit: unitFor(stRemaining),
})}
</span>
</p>
</div>
</div>
</div>
<div className='rr-card rr-share'>
<h3 className='rr-h3'>{copy.shareHeading}</h3>
<p className='rr-body'>{copy.shareBody}</p>
<label htmlFor={inputId} className='rr-label'>
{copy.linkLabel}
</label>
<div className='rr-field-wrap'>
<Link2 className='rr-field-ic' size={18} strokeWidth={2.5} aria-hidden='true' />
<input
id={inputId}
ref={inputRef}
className={'rr-input' + (copyState === 'error' ? ' is-error' : '')}
type='text'
readOnly
value={link}
placeholder={copy.linkPlaceholder}
aria-describedby={copyState === 'error' ? errId : undefined}
onFocus={(e) => e.currentTarget.select()}
/>
</div>
{copyState === 'error' ? (
<p id={errId} className='rr-error' role='alert'>
<AlertCircle className='rr-inline-ic' size={16} strokeWidth={2.5} aria-hidden='true' />
{copy.copyError}
</p>
) : null}
<div className='rr-actions'>
<button
type='button'
className={'rr-btn rr-btn-primary' + forced}
disabled={isDisabled}
onClick={() => void handleCopy()}
>
{copied ? (
<Check size={20} strokeWidth={2.5} aria-hidden='true' />
) : (
<Copy size={20} strokeWidth={2.5} aria-hidden='true' />
)}
<span>{copied ? copy.copiedLabel : copy.copyLabel}</span>
</button>
<button type='button' className='rr-btn rr-btn-secondary' disabled={isDisabled} onClick={handleShare}>
<Share2 size={20} strokeWidth={2.5} aria-hidden='true' />
<span>{copy.shareLabel}</span>
</button>
</div>
{note ? <p className='rr-note'>{note}</p> : null}
<span className='rr-sr' aria-live='polite'>
{copied ? copy.copiedLabel : ''}
</span>
</div>
</div>
</div>
</div>
</section>
);
}
export default ReferralRewards;
function fill(template: string, vars: Record<string, string | number>): string {
return Object.keys(vars).reduce((out, key) => out.split('{' + key + '}').join(String(vars[key])), template);
}
const CSS = `
.cf-referral-rewards{--rr-sh:var(--shadow,oklch(0.22 0.03 260));--rr-art:150px;position:relative;isolation:isolate;overflow:hidden;background:var(--surface);color:var(--ink);font-family:var(--font-body);padding-top:clamp(56px,8vw,112px)}
.cf-referral-rewards *,.cf-referral-rewards *::before,.cf-referral-rewards *::after{box-sizing:border-box}
.cf-referral-rewards .rr-wrap{position:relative;max-width:1120px;margin:0 auto;padding:0 clamp(16px,5vw,48px)}
.cf-referral-rewards .rr-head{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(0,1fr);gap:clamp(32px,5vw,72px);align-items:start}
.cf-referral-rewards .rr-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;color:var(--ink);text-wrap:balance}
.cf-referral-rewards .rr-h2 mark{color:oklch(from var(--marker,#fae37c) 0.24 0.05 h);background:var(--marker,#fae37c);background:oklch(from var(--marker,#fae37c) max(l,0.9) min(c,0.16) h);padding:0 0.14em;margin:0 -0.04em;border-radius:0.2em 0.42em 0.26em 0.36em;-webkit-box-decoration-break:clone;box-decoration-break:clone}
.cf-referral-rewards .rr-lead{margin:0;max-width:60ch;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-referral-rewards .rr-tally{padding-top:8px}
.cf-referral-rewards .rr-count{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:12px;row-gap:4px;margin:0}
.cf-referral-rewards .rr-big{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--ink)}
.cf-referral-rewards .rr-count-label{font-size:0.9375rem;line-height:1.4;font-weight:700;color:var(--muted)}
.cf-referral-rewards .rr-next{margin:16px 0 0;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:700;color:var(--ink);text-wrap:pretty}
.cf-referral-rewards .rr-hint{margin:12px 0 0;font-size:0.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-wrap:pretty}
.cf-referral-rewards .rr-inline-ic{display:inline-block;vertical-align:-0.15em;margin-inline-end:0.4em}
.cf-referral-rewards .rr-stage{position:relative;margin-top:clamp(40px,5vw,64px);padding-bottom:clamp(64px,8.5vw,120px)}
.cf-referral-rewards .rr-field{position:absolute;left:0;right:0;top:180px;bottom:0;z-index:-1;background:var(--band);clip-path:polygon(0 200px,100% 0,100% 100%,0 100%)}
.cf-referral-rewards .rr-stairs{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(var(--rr-n,3),minmax(0,1fr));gap:clamp(12px,1.6vw,20px);align-items:end}
.cf-referral-rewards .rr-step{position:relative;min-width:0;animation:rr-rise 0.45s cubic-bezier(0.2,0.7,0.2,1) both;animation-delay:min(calc(var(--i,0) * 0.07s),0.28s)}
.cf-referral-rewards .rr-stepbtn{appearance:none;display:flex;flex-direction:column;width:100%;margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer;-webkit-tap-highlight-color:transparent}
.cf-referral-rewards .rr-stepbtn:focus-visible{outline:none}
.cf-referral-rewards .rr-art{display:block;height:var(--rr-art);padding:0 8px 12px}
.cf-referral-rewards .rr-art img{display:block;width:100%;height:100%;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 2px 3px oklch(from var(--rr-sh) l c h / 0.3)) drop-shadow(0 12px 14px oklch(from var(--rr-sh) l c h / 0.2));transition:transform 0.2s cubic-bezier(0.2,0.7,0.2,1),filter 0.2s ease,opacity 0.2s ease}
.cf-referral-rewards .rr-step[data-state=locked] .rr-art img{filter:grayscale(0.85) drop-shadow(0 2px 3px oklch(from var(--rr-sh) l c h / 0.3)) drop-shadow(0 12px 14px oklch(from var(--rr-sh) l c h / 0.2));opacity:0.72}
.cf-referral-rewards .rr-tread{position:relative;display:flex;flex-direction:column;gap:8px;min-height:calc(184px + var(--i,0) * var(--rr-rise,64px));padding:clamp(20px,2.4vw,28px);background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-md));transition:transform 0.16s ease,box-shadow 0.16s ease}
.cf-referral-rewards .rr-step[data-state=next] .rr-tread{box-shadow:inset 0 0 0 2px var(--accent),var(--card-shadow,var(--shadow-md))}
.cf-referral-rewards .rr-step[data-state=reached] .rr-tread{background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));border-color:transparent}
.cf-referral-rewards .rr-badge{position:absolute;top:clamp(16px,2vw,24px);right:clamp(16px,2vw,24px);display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:999px;background:var(--secondary);color:var(--secondary-ink)}
.cf-referral-rewards .rr-step[data-state=reached] .rr-badge{background:var(--success);color:var(--rr-badge-glyph,#fff);outline:2px solid var(--accent-fill-ink,var(--card))}
.cf-referral-rewards .rr-step[data-state=next] .rr-badge{background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card))}
.cf-referral-rewards .rr-numrow{display:flex;align-items:baseline;gap:8px;padding-right:44px}
.cf-referral-rewards .rr-num{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums}
.cf-referral-rewards .rr-unit{font-size:0.9375rem;line-height:1.4;font-weight:700}
.cf-referral-rewards .rr-step[data-state=next] .rr-unit,.cf-referral-rewards .rr-step[data-state=locked] .rr-unit{color:var(--muted)}
.cf-referral-rewards .rr-title{display:block;font-family:var(--font-display);font-weight:800;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.25;text-wrap:balance}
.cf-referral-rewards .rr-foot{margin-top:auto;display:flex;flex-direction:column;align-items:flex-start;gap:12px;width:100%;padding-top:12px}
.cf-referral-rewards .rr-meter-wrap{display:flex;flex-direction:column;gap:8px;width:100%}
.cf-referral-rewards .rr-meter{display:block;width:100%;height:8px;border-radius:999px;overflow:hidden;background:color-mix(in oklch,var(--ink) 10%,var(--card))}
.cf-referral-rewards .rr-meter>span{display:block;height:100%;border-radius:inherit;background:var(--accent-fill,var(--accent));transform-origin:left center;animation:rr-fill 0.7s 0.25s cubic-bezier(0.2,0.7,0.2,1) both}
.cf-referral-rewards .rr-meter-label{font-size:0.9375rem;line-height:1.4;font-weight:600;color:var(--muted);font-variant-numeric:tabular-nums}
.cf-referral-rewards .rr-tag{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;font-size:0.875rem;font-weight:800;line-height:1.2;white-space:nowrap;background:var(--secondary);color:var(--secondary-ink)}
.cf-referral-rewards .rr-step[data-state=next] .rr-tag{background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card))}
.cf-referral-rewards .rr-step[data-state=reached] .rr-tag{background:transparent;color:inherit;box-shadow:inset 0 0 0 1.5px oklch(from var(--accent-fill-ink,var(--card)) l c h / 0.55)}
.cf-referral-rewards .rr-step.is-selected .rr-tread{transform:translateY(-8px);box-shadow:var(--shadow-lg)}
.cf-referral-rewards .rr-step[data-state=next].is-selected .rr-tread{box-shadow:inset 0 0 0 2px var(--accent),var(--shadow-lg)}
.cf-referral-rewards .rr-step.is-selected .rr-tread::after{content:'';position:absolute;left:clamp(20px,2.4vw,28px);right:clamp(20px,2.4vw,28px);bottom:10px;height:4px;border-radius:999px;background:var(--accent)}
.cf-referral-rewards .rr-step[data-state=reached].is-selected .rr-tread::after{background:var(--accent-fill-ink,var(--card))}
@media (hover:hover){
.cf-referral-rewards .rr-stepbtn:hover .rr-tread{transform:translateY(-4px);box-shadow:var(--shadow-lg)}
.cf-referral-rewards .rr-step[data-state=next] .rr-stepbtn:hover .rr-tread{box-shadow:inset 0 0 0 2px var(--accent),var(--shadow-lg)}
.cf-referral-rewards .rr-step.is-selected .rr-stepbtn:hover .rr-tread{transform:translateY(-8px)}
.cf-referral-rewards .rr-stepbtn:hover .rr-art img{transform:translateY(-4px) scale(1.03)}
.cf-referral-rewards .rr-step[data-state=locked] .rr-stepbtn:hover .rr-art img{opacity:0.9}
}
.cf-referral-rewards .rr-stepbtn:active .rr-tread{transform:translateY(-2px)}
.cf-referral-rewards .rr-stepbtn:focus-visible .rr-tread{outline:3px solid var(--field-focus,var(--accent));outline-offset:4px}
.cf-referral-rewards .rr-lower{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:24px;margin-top:32px;align-items:start}
.cf-referral-rewards .rr-card{background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-md));padding:clamp(20px,3vw,32px)}
.cf-referral-rewards .rr-panel{scroll-margin:24px}
.cf-referral-rewards .rr-panel-in{display:grid;grid-template-columns:minmax(0,180px) minmax(0,1fr);gap:clamp(20px,3vw,32px);align-items:start;animation:rr-rise 0.45s cubic-bezier(0.2,0.7,0.2,1) both}
.cf-referral-rewards .rr-panel-in.no-art{grid-template-columns:minmax(0,1fr)}
.cf-referral-rewards .rr-panel-art{width:100%;aspect-ratio:1/1}
.cf-referral-rewards .rr-panel-art img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 2px 3px oklch(from var(--rr-sh) l c h / 0.3)) drop-shadow(0 12px 14px oklch(from var(--rr-sh) l c h / 0.2))}
.cf-referral-rewards .rr-tier{margin:0 0 8px;font-size:0.9375rem;line-height:1.4;font-weight:700;color:var(--muted)}
.cf-referral-rewards .rr-h3{margin:0 0 12px;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;color:var(--ink);text-wrap:balance}
.cf-referral-rewards .rr-body{margin:0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--ink);text-wrap:pretty}
.cf-referral-rewards .rr-perks{list-style:none;margin:16px 0 0;padding:0;display:grid;gap:8px}
.cf-referral-rewards .rr-perks li{display:flex;align-items:flex-start;gap:8px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
.cf-referral-rewards .rr-perks svg{flex:none;margin-top:0.2em;color:var(--success)}
.cf-referral-rewards .rr-status{display:flex;align-items:center;gap:12px;margin:20px 0 0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.4;font-weight:700;color:var(--ink);text-wrap:pretty}
.cf-referral-rewards .rr-status.is-reached{color:var(--success)}
.cf-referral-rewards .rr-status-badge{display:grid;place-items:center;flex:none;width:28px;height:28px;border-radius:999px;background:var(--success);color:var(--rr-badge-glyph,#fff)}
.cf-referral-rewards .rr-status-lock{flex:none;color:var(--muted)}
.cf-referral-rewards .rr-share .rr-body{margin-bottom:20px}
.cf-referral-rewards .rr-label{display:block;margin:0 0 8px;font-size:1rem;line-height:1.3;font-weight:700;color:var(--label-ink,var(--ink))}
.cf-referral-rewards .rr-field-wrap{position:relative}
.cf-referral-rewards .rr-field-ic{position:absolute;left:16px;top:50%;transform:translateY(-50%);color:color-mix(in oklch,var(--field-ink) 65%,var(--field));pointer-events:none}
.cf-referral-rewards .rr-input{display:block;width:100%;height:56px;margin:0;padding:0 16px 0 46px;font-family:var(--font-body);font-size:17px;font-weight:600;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 0.16s ease,box-shadow 0.16s ease}
.cf-referral-rewards .rr-input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1;font-weight:500}
.cf-referral-rewards .rr-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-rewards .rr-input.is-error{border-color:var(--danger)}
.cf-referral-rewards .rr-input.is-error:focus{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / 0.3)}
.cf-referral-rewards .rr-error{margin:8px 0 0;font-size:0.9375rem;line-height:1.4;font-weight:600;color:var(--danger);text-wrap:pretty}
.cf-referral-rewards .rr-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:16px}
.cf-referral-rewards .rr-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:56px;padding:0 24px;border:1px solid transparent;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;cursor:pointer;transition:transform 0.16s ease,box-shadow 0.16s ease,background 0.16s ease}
.cf-referral-rewards .rr-btn svg{flex:none}
.cf-referral-rewards .rr-btn-primary{flex:1 1 11rem;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(--rr-sh) l c h / 0.3),0 8px 16px -6px oklch(from var(--rr-sh) l c h / 0.45))}
.cf-referral-rewards .rr-btn-primary:hover:not(:disabled),.cf-referral-rewards .rr-btn-primary.is-hover:not(:disabled){transform:translateY(-1px);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(--rr-sh) l c h / 0.34),0 10px 18px -6px oklch(from var(--rr-sh) l c h / 0.55))}
.cf-referral-rewards .rr-btn-primary:active:not(:disabled),.cf-referral-rewards .rr-btn-primary.is-active:not(:disabled){transform:translateY(1px);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.08) c h));box-shadow:inset 0 2px 4px oklch(from var(--rr-sh) l c h / 0.35),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 1px oklch(from var(--rr-sh) l c h / 0.25)}
.cf-referral-rewards .rr-btn-secondary{flex:0 1 auto;color:var(--button-2-ink,var(--secondary-ink));background:var(--button-2-bg,var(--secondary));border-color:var(--button-2-border,transparent);box-shadow:var(--button-2-shadow,var(--shadow-sm))}
.cf-referral-rewards .rr-btn-secondary:hover:not(:disabled){transform:translateY(-1px);background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - 0.04) c h)}
.cf-referral-rewards .rr-btn-secondary:active:not(:disabled){transform:translateY(1px);box-shadow:none}
.cf-referral-rewards .rr-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
.cf-referral-rewards .rr-btn:disabled{cursor:not-allowed;transform:none;background:color-mix(in oklch,var(--ink) 8%,var(--card));color:var(--muted);text-shadow:none;box-shadow:none;border-color:transparent}
.cf-referral-rewards .rr-note{margin:16px 0 0;font-size:0.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-referral-rewards .rr-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@media (max-width:1024px){
.cf-referral-rewards .rr-lower{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:760px){
.cf-referral-rewards .rr-head{grid-template-columns:minmax(0,1fr);gap:24px}
.cf-referral-rewards .rr-tally{padding-top:0}
.cf-referral-rewards .rr-stage{margin-top:32px;padding-top:32px}
.cf-referral-rewards .rr-field{top:0;clip-path:polygon(0 88px,100% 0,100% 100%,0 100%)}
.cf-referral-rewards .rr-stairs{display:flex;flex-direction:column;gap:12px}
.cf-referral-rewards .rr-step:not(:last-child)::after{content:'';position:absolute;left:30px;top:100%;width:4px;height:12px;border-radius:2px;background:oklch(from var(--band-ink) l c h / 0.35)}
.cf-referral-rewards .rr-step[data-state=reached]:not(:last-child)::after{background:var(--band-ink)}
.cf-referral-rewards .rr-stepbtn{position:relative}
.cf-referral-rewards .rr-art{position:absolute;z-index:1;right:12px;top:50%;width:88px;height:88px;padding:0;transform:translateY(-50%);pointer-events:none}
.cf-referral-rewards .rr-art img{object-position:center}
.cf-referral-rewards .rr-tread{min-height:0;display:grid;grid-template-columns:32px minmax(0,1fr);column-gap:16px;row-gap:4px;align-items:start;padding:16px 112px 20px 16px}
.cf-referral-rewards .rr-step.no-art .rr-tread{padding-right:16px}
.cf-referral-rewards .rr-badge{position:static;grid-column:1;grid-row:1 / span 3}
.cf-referral-rewards .rr-numrow,.cf-referral-rewards .rr-title,.cf-referral-rewards .rr-foot{grid-column:2}
.cf-referral-rewards .rr-numrow{padding-right:0}
.cf-referral-rewards .rr-num{font-size:2rem}
.cf-referral-rewards .rr-foot{padding-top:8px;gap:8px}
.cf-referral-rewards .rr-step.rr-step .rr-stepbtn .rr-tread{transform:none}
.cf-referral-rewards .rr-step.is-selected .rr-tread::after{left:64px;right:auto;width:48px;bottom:8px}
.cf-referral-rewards .rr-lower{margin-top:24px}
.cf-referral-rewards .rr-panel-in{grid-template-columns:minmax(0,1fr);gap:16px}
.cf-referral-rewards .rr-panel-art{width:132px}
.cf-referral-rewards .rr-actions .rr-btn{flex:1 1 auto}
}
@keyframes rr-rise{from{opacity:0.82;transform:translateY(8px)}}
@keyframes rr-fill{from{transform:scaleX(0)}}
@media (prefers-reduced-motion:reduce){
.cf-referral-rewards .rr-step,.cf-referral-rewards .rr-panel-in,.cf-referral-rewards .rr-meter>span{animation:none}
.cf-referral-rewards .rr-tread,.cf-referral-rewards .rr-art img,.cf-referral-rewards .rr-btn,.cf-referral-rewards .rr-input{transition:none}
}
`;
pieces/content/referral-rewards/specimen.tsx 62 lines
import __studioImageea5c0379 from "../assets/646bf055bf6f04d7.webp";
import __studioImage6196143c from "../assets/357b21e004470be6.webp";
import __studioImaged71a8882 from "../assets/958f95b403dfcef9.webp";
import React from 'react';
import { ReferralRewards, type ReferralRewardsProps } from '../referral-rewards';
import { slot } from '../../slots';
export const states = ['default', 'hover', 'active', 'disabled', 'error'];
export default function ReferralRewardsSpecimen({ state = 'default' }: { state?: string }) {
return (
<ReferralRewards
state={state as ReferralRewardsProps['state']}
headline={
<>
Bring a writer in. <mark>Climb to your next reward.</mark>
</>
}
lead='Every writer who joins Copy Cohort Studio with your link moves you up a step. Reach a step and its reward is yours.'
count={3}
link='copycohort.studio/r/maya-k'
shareTitle='Copy Cohort Studio'
shareText='I write with Copy Cohort Studio. Come join me:'
note='Rewards unlock when your friend’s first month begins.'
rewards={[
{
friends: 1,
title: 'Margin Notes sticker pack',
detail: 'Twelve die-cut vinyl stickers for your laptop and notebook, mailed to your door.',
perks: ['12 weatherproof vinyl stickers', 'Shipped free with tracking'],
image: slot(
'item-1',
__studioImageea5c0379,
),
imageAlt: 'Margin Notes sticker pack fanned out',
},
{
friends: 3,
title: 'Swipe File template bundle',
detail: 'Nine fill-in templates for hooks, emails and sales pages, ready to duplicate into your own docs.',
perks: ['9 editable templates', 'A worked example inside each one'],
image: slot(
'item-2',
__studioImage6196143c,
),
imageAlt: 'Swipe File template bundle tied with a band',
},
{
friends: 5,
title: '1:1 draft review',
detail: 'Thirty minutes on a call with a Copy Cohort editor, line by line, on one piece you’re writing now.',
perks: ['30-minute live review', 'Written notes to keep'],
image: slot(
'item-3',
__studioImaged71a8882,
),
imageAlt: 'Marked-up draft on a clipboard with headphones beside it',
},
]}
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalReferralRewards |
React.ReactNode |
|
lead OptionalReferralRewards |
React.ReactNode |
|
count OptionalReferralRewards |
number |
|
rewards OptionalReferralRewards |
ReferralReward[] |
|
link OptionalReferralRewards |
string |
|
note OptionalReferralRewards |
string |
|
shareTitle OptionalReferralRewards |
string |
|
shareText OptionalReferralRewards |
string |
|
copy OptionalReferralRewards |
Partial<ReferralRewardsCopy> |
|
disabled OptionalReferralRewards |
boolean |
|
state OptionalReferralRewards |
'default' | 'hover' | 'active' | 'disabled' | 'error' |
|
onCopy OptionalReferralRewards |
(link: string) => void |
|
onShare OptionalReferralRewards |
(link: string) => void |
|
onStepSelect OptionalReferralRewards |
(reward: ReferralReward, index: number) => void |
|
className OptionalReferralRewards |
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.
item-3- One image per offer item (item-1, item-2…), shown in stacks and lists.
-
357b21e004470be6.webp
image/webp · 157 KB
-
646bf055bf6f04d7.webp
image/webp · 149 KB
-
958f95b403dfcef9.webp
image/webp · 193 KB