Red Pen Edit 1
Red pen edit: the visitor's old belief is typeset big, then corrected in front of them (strike, caret,
Use it in a prompt
Use content/red-pen-edit 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/red-pen-edit.tsx. - Import it and pass your copy and images (Props tab):
import { RedPenEdit } from "@/components/funneldna/content/red-pen-edit"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/red-pen-edit/component.tsx 239 lines
// layout: spotlight-row
// Red pen edit: the visitor's old belief is typeset big, then corrected in front of them (strike, caret,
// pen-colour fix), so the new belief lands as the one idea this section sells. Type-led scroll-stopper, no action.
import * as React from 'react';
import { Texture, FX_HOST } from '../fx/fx';
import concrete from '../fx/textures/concrete';
/** Whatever the shared fx Texture accepts as its source (an imported texture module). */
type TextureSrc = React.ComponentProps<typeof Texture>['src'];
/** One correction: the words struck out (omit for a pure insertion) and the handwritten replacement above them. */
export type RedPenCorrection = { strike?: string; insert: string };
/** A plain run of the sentence (it carries its own spaces) or a correction. */
export type RedPenSegment = string | RedPenCorrection;
export type RedPenEditProps = {
/** One short setup sentence on the stage above the sheet. */
lead?: React.ReactNode;
/** The old belief, split into plain runs and corrections. */
segments?: RedPenSegment[];
/** Pen-colour note under the sentence, written last. Sits in the main column, never a side margin. */
note?: React.ReactNode;
/** Short one-sentence lines in the row beneath the sheet. */
points?: React.ReactNode[];
/** Single-word emphasis line that closes the row. */
punch?: React.ReactNode;
/** Screen-reader labels for the two versions of the sentence. */
copy?: { oldLabel?: string; newLabel?: string };
/** 'band': dark stage (default); 'light': quiet grey stage. */
tone?: 'band' | 'light';
/** Texture on the stage (import from ../fx/textures); null for none. */
textureSrc?: TextureSrc | null;
/** Draw the marks as the sentence scrolls into view; false renders the finished edit. */
animate?: boolean;
className?: string;
};
const DEFAULT_SEGMENTS: RedPenSegment[] = ['Customers buy the ', { strike: 'cheapest', insert: 'clearest' }, ' option.'];
const DEFAULT_POINTS: React.ReactNode[] = [
'Nobody pays for a result they can’t picture.',
'Show the outcome, and price stops leading.',
];
const ZWSP = String.fromCharCode(8203);
const useIsoLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
type Phase = 'static' | 'armed' | 'drawn';
type Step =
| { kind: 'text'; text: string }
| { kind: 'edit'; insert: string; words: string[]; tWords: number[]; tOld: number; tCaret: number; tFix: number };
export function RedPenEdit({
lead = 'Somewhere along the way, you were handed this sentence.',
segments = DEFAULT_SEGMENTS,
note = 'Cheap only wins when nothing else is clear.',
points = DEFAULT_POINTS,
punch = 'Clarity.',
copy,
tone = 'band',
textureSrc = concrete,
animate = true,
className,
}: RedPenEditProps) {
const stageRef = React.useRef<HTMLDivElement>(null);
const [phase, setPhase] = React.useState<Phase>('static');
const headingId = React.useId();
const hasSentence = Array.isArray(segments) && segments.length > 0;
useIsoLayoutEffect(() => {
const el = stageRef.current;
const reduce = typeof window !== 'undefined' && !!window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (!animate || !el || reduce || typeof IntersectionObserver === 'undefined') {
setPhase('static');
return;
}
setPhase('armed');
const io = new IntersectionObserver(
(entries) => {
if (entries.some((entry) => entry.isIntersecting)) {
setPhase('drawn');
io.disconnect();
}
},
{ threshold: 0.35, rootMargin: '0px 0px -12% 0px' },
);
io.observe(el);
return () => io.disconnect();
}, [animate, hasSentence]);
if (!hasSentence) return null;
const { steps, tNote } = planEdits(segments);
const oldText = squash(segments.map((s) => (typeof s === 'string' ? s : s.strike ?? '')).join(''));
const newText = squash(segments.map((s) => (typeof s === 'string' ? s : s.insert)).join(''));
const srText = `${copy?.oldLabel ?? 'Old:'} ${oldText} ${copy?.newLabel ?? 'New:'} ${newText}`;
const rowItems = (points ?? []).filter(Boolean);
const hasRow = rowItems.length > 0 || Boolean(punch);
return (
<section
className={['cf-red-pen-edit', className].filter(Boolean).join(' ')}
data-phase={phase}
data-tone={tone}
aria-labelledby={headingId}
>
<style>{CSS}</style>
<div className='rpe-top'>
<div className='rpe-ground' style={{ ...FX_HOST, position: 'absolute', inset: 0 }} aria-hidden='true'>
{textureSrc ? <Texture src={textureSrc} tone={tone === 'light' ? 'ink' : 'band-ink'} /> : null}
</div>
<div className='rpe-wrap'>
{lead ? <p className='rpe-lead'>{lead}</p> : null}
<div className='rpe-card'>
<div className='rpe-stage' ref={stageRef}>
<h2 className='rpe-sentence' id={headingId}>
<span className='rpe-sr'>{srText}</span>
<span aria-hidden='true'>
{steps.map((step, i) =>
step.kind === 'text' ? (
<React.Fragment key={i}>{step.text}</React.Fragment>
) : (
<span className='rpe-edit' key={i}>
<span className='rpe-fix' style={at(step.tFix)}>
{step.insert}
</span>
<span className='rpe-old' style={at(step.tOld)}>
{step.words.length > 0
? step.words.map((word, j) => (
<React.Fragment key={j}>
{j > 0 ? ' ' : null}
<span className='rpe-word' style={at(step.tWords[j])}>
{word}
<svg className='rpe-strike' viewBox='0 0 100 12' preserveAspectRatio='none' focusable='false'>
<path pathLength={1} d='M2 8.8C28 7.6 61 5.8 98 3.4' />
</svg>
</span>
</React.Fragment>
))
: ZWSP}
</span>
<svg className='rpe-caret' viewBox='0 0 40 24' style={at(step.tCaret)} focusable='false'>
<path pathLength={1} d='M5 21L20 5L35 21' />
</svg>
</span>
),
)}
</span>
</h2>
{note ? (
<p className='rpe-note' style={at(tNote)}>
{note}
</p>
) : null}
</div>
</div>
</div>
</div>
<div className='rpe-bottom' data-empty={hasRow ? undefined : ''}>
{hasRow ? (
<div className='rpe-row'>
{rowItems.map((point, i) => (
<p className='rpe-point' key={i}>
{point}
</p>
))}
{punch ? <p className='rpe-punch'>{punch}</p> : null}
</div>
) : null}
</div>
</section>
);
}
export default RedPenEdit;
function planEdits(segments: RedPenSegment[]) {
let clock = 0.1;
const steps = segments.map((seg): Step => {
if (typeof seg === 'string') return { kind: 'text', text: seg };
const words = (seg.strike ?? '').split(/\s+/).filter(Boolean);
const tWords = words.map((_, j) => clock + j * 0.22);
const tOld = clock + 0.2;
const tCaret = clock + words.length * 0.22 + 0.3;
const tFix = tCaret + 0.15;
clock = tFix + 0.75;
return { kind: 'edit', insert: seg.insert, words, tWords, tOld, tCaret, tFix };
});
return { steps, tNote: clock + 0.1 };
}
function squash(text: string) {
return text.replace(/\s+/g, ' ').trim();
}
function at(t: number): React.CSSProperties {
return { ['--t' as string]: t.toFixed(2) } as React.CSSProperties;
}
const CSS = `
.cf-red-pen-edit{--rpe-over:clamp(40px,6vw,88px);--rpe-gutter:clamp(16px,5vw,48px);--rpe-pad:clamp(24px,4.5vw,56px);--rpe-pen:var(--accent,oklch(0.5 0.17 257));position:relative;background:var(--surface,#ffffff);color:var(--ink,#1b2333);font-family:var(--font-body,system-ui,sans-serif);overflow-x:clip}
.cf-red-pen-edit *,.cf-red-pen-edit *::before,.cf-red-pen-edit *::after{box-sizing:border-box}
.cf-red-pen-edit .rpe-top{position:relative;z-index:1;padding:clamp(56px,8vw,112px) var(--rpe-gutter) 0;background:var(--band,oklch(0.27 0.07 256));color:var(--band-ink,#ffffff)}
.cf-red-pen-edit[data-tone='light'] .rpe-top{background:color-mix(in oklch,var(--ink,#1b2333) 5%,var(--surface,#ffffff));color:var(--ink,#1b2333)}
.cf-red-pen-edit .rpe-ground{z-index:0;pointer-events:none}
.cf-red-pen-edit .rpe-wrap{position:relative;z-index:1;max-inline-size:1120px;margin-inline:auto;min-width:0}
.cf-red-pen-edit .rpe-lead{margin:0 0 clamp(20px,2.5vw,28px);max-inline-size:60ch;font-size:clamp(1.125rem,1.5vw,1.375rem);font-weight:500;line-height:1.4;color:var(--band-ink,#ffffff);text-wrap:pretty;overflow-wrap:anywhere}
.cf-red-pen-edit[data-tone='light'] .rpe-lead{color:var(--ink,#1b2333)}
.cf-red-pen-edit .rpe-card{position:relative;z-index:1;margin-bottom:calc(-1 * var(--rpe-over));padding:var(--rpe-pad);min-width:0;background:var(--card,#ffffff);color:var(--ink,#1b2333);border:1px solid var(--card-border,oklch(from var(--ink,#1b2333) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(0.22 0.03 256 / .22),0 12px 24px -8px oklch(0.22 0.03 256 / .32)))}
.cf-red-pen-edit .rpe-stage{container:rpe / inline-size;min-width:0}
.cf-red-pen-edit .rpe-sentence{margin:0;font-family:var(--font-display,system-ui,sans-serif);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2.25rem,1.2rem + 5.2vw,4.875rem);font-size:clamp(2.25rem,1.2rem + 6.4cqi,4.875rem);line-height:1.08;color:var(--ink,#1b2333);text-wrap:balance;overflow-wrap:anywhere;hyphens:auto}
.cf-red-pen-edit .rpe-edit{position:relative;display:inline-block;vertical-align:baseline;max-inline-size:100%;text-align:center}
.cf-red-pen-edit .rpe-fix{display:block;margin-bottom:.08em;font-size:.5em;line-height:1;color:var(--rpe-pen);transform:rotate(-2deg);text-wrap:balance;overflow-wrap:anywhere}
.cf-red-pen-edit .rpe-old{display:block;color:var(--muted,#4b5563)}
.cf-red-pen-edit .rpe-word{position:relative;display:inline-block;max-inline-size:100%}
.cf-red-pen-edit .rpe-strike{position:absolute;left:-.06em;top:.4em;width:calc(100% + .12em);height:.32em;overflow:visible;color:var(--rpe-pen);pointer-events:none}
.cf-red-pen-edit .rpe-strike path{fill:none;stroke:currentColor;stroke-width:2.8;stroke-linecap:round;stroke-dasharray:1 2;stroke-dashoffset:0}
.cf-red-pen-edit .rpe-caret{display:block;width:.44em;height:.27em;margin:-.1em auto 0;overflow:visible;color:var(--rpe-pen)}
.cf-red-pen-edit .rpe-caret path{fill:none;stroke:currentColor;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2;stroke-dashoffset:0}
.cf-red-pen-edit .rpe-note{margin:clamp(24px,3vw,32px) 0 0;max-inline-size:60ch;font-size:clamp(1.125rem,1.5vw,1.375rem);font-weight:600;line-height:1.4;color:var(--rpe-pen);text-wrap:pretty;overflow-wrap:anywhere}
.cf-red-pen-edit .rpe-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-red-pen-edit .rpe-bottom{position:relative;z-index:0;padding:calc(var(--rpe-over) + clamp(32px,4vw,56px)) var(--rpe-gutter) clamp(64px,8.5vw,120px)}
.cf-red-pen-edit .rpe-bottom[data-empty]{padding-top:var(--rpe-over);padding-bottom:clamp(40px,5vw,64px)}
.cf-red-pen-edit .rpe-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,15rem),1fr));gap:clamp(16px,3vw,40px);align-items:start;max-inline-size:1120px;margin:0 auto;padding-inline:var(--rpe-pad)}
.cf-red-pen-edit .rpe-point{margin:0;min-width:0;font-size:clamp(1.125rem,1.5vw,1.375rem);font-weight:600;line-height:1.35;color:var(--ink,#1b2333);text-wrap:pretty;overflow-wrap:anywhere}
.cf-red-pen-edit .rpe-punch{margin:0;min-width:0;font-family:var(--font-display,system-ui,sans-serif);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(--accent,oklch(0.5 0.17 257));text-wrap:balance;overflow-wrap:anywhere;hyphens:auto}
@container rpe (max-width: 520px){
.cf-red-pen-edit .rpe-fix{font-size:.56em;margin-bottom:.1em}
}
@media (prefers-reduced-motion: no-preference){
.cf-red-pen-edit .rpe-strike path{transition:stroke-dashoffset .45s cubic-bezier(.6,.05,.3,1) calc(var(--t,0) * 1s)}
.cf-red-pen-edit .rpe-caret path{transition:stroke-dashoffset .28s cubic-bezier(.4,0,.2,1) calc(var(--t,0) * 1s)}
.cf-red-pen-edit .rpe-old{transition:color .35s ease calc(var(--t,0) * 1s)}
.cf-red-pen-edit .rpe-fix,.cf-red-pen-edit .rpe-note{transition:opacity .45s cubic-bezier(.2,.7,.2,1) calc(var(--t,0) * 1s),transform .45s cubic-bezier(.2,.7,.2,1) calc(var(--t,0) * 1s)}
.cf-red-pen-edit[data-phase='armed'] .rpe-strike path,.cf-red-pen-edit[data-phase='armed'] .rpe-caret path{stroke-dashoffset:1}
.cf-red-pen-edit[data-phase='armed'] .rpe-old{color:var(--ink,#1b2333)}
.cf-red-pen-edit[data-phase='armed'] .rpe-fix{opacity:0;transform:translateY(.22em) rotate(-2deg)}
.cf-red-pen-edit[data-phase='armed'] .rpe-note{opacity:.82;transform:translateY(8px);color:transparent}
}
`;
pieces/content/red-pen-edit/specimen.tsx 16 lines
// Specimen: The Pricing Room (fictional) corrects the belief its coaching clients arrive with.
import RedPenEdit from '../red-pen-edit';
export const states = ['default'];
export default function RedPenEditSpecimen(_props: { state?: 'default' }) {
return (
<RedPenEdit
lead='Before The Pricing Room touches your rates, we fix one sentence.'
segments={['Clients hire the ', { strike: 'cheapest', insert: 'clearest' }, ' coach.']}
note='Price only decides when nothing else is clear.'
points={['A client can’t compare a package they can’t picture.', 'Name the outcome, the steps and the timeline.']}
punch='Clarity.'
/>
);
}
| Name | Type | Details |
|---|---|---|
lead OptionalRedPenEdit |
React.ReactNode |
Default 'Somewhere along the way, you were handed this sentence.'
|
segments OptionalRedPenEdit |
RedPenSegment[] |
Default DEFAULT_SEGMENTS
|
note OptionalRedPenEdit |
React.ReactNode |
Default 'Cheap only wins when nothing else is clear.'
|
points OptionalRedPenEdit |
React.ReactNode[] |
Default DEFAULT_POINTS
|
punch OptionalRedPenEdit |
React.ReactNode |
Default 'Clarity.'
|
copy OptionalRedPenEdit |
{ oldLabel?: string; newLabel?: string } |
|
tone OptionalRedPenEdit |
'band' | 'light' |
Default 'band'
|
textureSrc OptionalRedPenEdit |
TextureSrc | null |
Default concrete
|
animate OptionalRedPenEdit |
boolean |
Default true
|
className OptionalRedPenEdit |
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.
--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.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
This piece reads no image slots.
-
f211b3080387e46d.webp
image/webp · 105 KB