Page sections / Blog & articles
Long-Form Editorial Section
Narrow 600px centered reading column under a silver-gradient display heading; body in gray 16px with key phrases highlighted in near-white medium weight. Large embedded SVG diagrams interleave the prose, and a fixed pill nav lists section anchors.
Rebuilt from resend.com/features/forge in the Obsidian Serif Glow style.
Looks exactly like resend.com: brings its fonts and colours, namespaced so your own theme stays untouched.
Restyled to your project: uses your shadcn colours, fonts and radius, so it matches the rest of your app. Layout, type sizes and motion stay as designed.
Usage
Props: heading, paragraphs (array of {before, highlight, after}) and sections (anchor ids and labels for the pill nav). The nav fades in after scrolling and highlights the section currently in view; paragraph ids follow the sections order.
components/long-form-article-section.tsx
"use client"; import { useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useState } from "react"; const DEFAULT_SECTIONS = [ { id: "intro", label: "Overview" }, { id: "routes", label: "Routes" }, { id: "signals", label: "Signals" }, ]; export default function LongFormEditorialSection(props: { heading?: string; paragraphs?: { before: string; highlight?: string; after?: string }[]; sections?: { id: string; label: string }[]; }) { const heading = props.heading ?? "Why steady delivery takes real upkeep"; const sections = props.sections ?? DEFAULT_SECTIONS; const paragraphs = props.paragraphs ?? [ { before: "With the headline figures in hand, the remainder of this article covers how the system holds steady and, put differently, why ", highlight: "a weekend prototype will never match a mature sending platform", after: ".", }, { before: "Reliable sending is maintenance work, repeated daily for every mailbox provider. None of the steps are secret: ramp up new addresses gradually, track reputation signals, study the feedback each inbox returns, and keep bad actors away from shared capacity. We lean on proven tooling and a few custom pieces, so your team can consider the problem handled.", }, { before: "Each part below is explained in order. We begin with the address pools your messages originate from, then how abusive senders are filtered, the relationships we keep with provider teams, the metrics we watch, and our plan for when Northwind itself is down.", }, { before: "Curious about the details? Keep scrolling." }, ]; const [active, setActive] = useState(sections[0]?.id); const [visible, setVisible] = useState(false); useEffect(() => { const onScroll = () => setVisible(window.scrollY > 40); onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); const els = sections.map((s) => document.getElementById(s.id)).filter(Boolean) as HTMLElement[]; const io = new IntersectionObserver( (entries) => entries.forEach((e) => e.isIntersecting && setActive(e.target.id)), { rootMargin: "-40% 0px -50% 0px" } ); els.forEach((el) => io.observe(el)); return () => { window.removeEventListener("scroll", onScroll); io.disconnect(); }; }, [sections]); return ( <section className="relative bg-background px-6 py-24 font-sans text-secondary"> <nav aria-label="Sections" className={`fixed bottom-6 left-1/2 z-20 flex -translate-x-1/2 gap-1 rounded-pill border border-hairline bg-surface/80 p-1 shadow-card-soft backdrop-blur transition-opacity duration-500 ${visible ? "opacity-100" : "pointer-events-none opacity-0"}`} > {sections.map((s) => ( <a key={s.id} href={`#${s.id}`} className={`rounded-pill px-4 py-1.5 text-ui transition-colors duration-hover-color ease-hover-color focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-blue ${active === s.id ? "bg-surface-high text-primary" : "text-secondary hover:text-primary"}`} > {s.label} </a> ))} </nav> <div className="mx-auto max-w-[600px]"> <Reveal from="up"> <h2 className="bg-silver-text bg-clip-text text-center font-display text-h2 text-transparent">{heading}</h2> </Reveal> <div className="mt-16 space-y-5 text-[16px] leading-[27px]"> {paragraphs.map((p, i) => ( <Reveal key={i} from="up" delay={i * 60}> <p id={sections[i]?.id}> {p.before} {p.highlight && <span className="font-medium text-primary">{p.highlight}</span>} {p.after} </p> </Reveal> ))} </div> </div> <div className="h-40" /> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal ---- const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)"; const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect; function ykReducedMotion(): boolean { return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches; } // "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance. // Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed, // and there is a box to watch), and a safety net reveals anything on screen that is still hidden. type YkRevealState = "idle" | "hidden" | "shown"; function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState { const [state, setState] = useState<YkRevealState>("idle"); useYkLayoutEffect(() => { const el = ref.current; if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return; // watch the element's own box, or its children when it has none (display: contents) const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]); const onScreen = (t: Element) => { const r = t.getBoundingClientRect(); return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth; }; if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible let shown = false; const show = (v: boolean) => { if (v !== shown) (shown = v), setState(v ? "shown" : "hidden"); }; setState("hidden"); const inView = new Set<Element>(); const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) inView.add(e.target); else inView.delete(e.target); } if (inView.size) { show(true); if (once) io.disconnect(); } else if (!once) show(false); }); const watched = new Set<Element>(); const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t))); watch(); // safety net: styles that land after mount (display: contents) get watched too, and nothing // stays hidden for more than a moment while it is actually on screen const start = Date.now(); const net = setInterval(() => { if (shown) return once && clearInterval(net); watch(); if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true); }, 600); return () => { io.disconnect(); clearInterval(net); }; }, [once]); return state; } type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none"; /** Fades content in as it scrolls into view. */ function Reveal({ children, from = "up", delay = 0, duration = 700, distance = 24, once = true, as = "div", className, style, }: { children?: ReactNode; from?: YkRevealFrom; delay?: number; duration?: number; distance?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); const hidden = state === "hidden"; const offset = { up: `translate3d(0, ${distance}px, 0)`, down: `translate3d(0, ${-distance}px, 0)`, left: `translate3d(${-distance}px, 0, 0)`, right: `translate3d(${distance}px, 0, 0)`, scale: "scale(0.94)", blur: `translate3d(0, ${distance / 2}px, 0)`, none: "none", }[from]; const t = `${duration}ms ${YK_EASE} ${delay}ms`; return ( <Tag ref={ref} className={className} style={{ ...style, ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }), ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }), }} > {children} </Tag> ); }"use client"; import { useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; import { useEffect, useState } from "react"; const DEFAULT_SECTIONS = [ { id: "intro", label: "Overview" }, { id: "routes", label: "Routes" }, { id: "signals", label: "Signals" }, ]; export default function LongFormEditorialSection(props: { heading?: string; paragraphs?: { before: string; highlight?: string; after?: string }[]; sections?: { id: string; label: string }[]; }) { const heading = props.heading ?? "Why steady delivery takes real upkeep"; const sections = props.sections ?? DEFAULT_SECTIONS; const paragraphs = props.paragraphs ?? [ { before: "With the headline figures in hand, the remainder of this article covers how the system holds steady and, put differently, why ", highlight: "a weekend prototype will never match a mature sending platform", after: ".", }, { before: "Reliable sending is maintenance work, repeated daily for every mailbox provider. None of the steps are secret: ramp up new addresses gradually, track reputation signals, study the feedback each inbox returns, and keep bad actors away from shared capacity. We lean on proven tooling and a few custom pieces, so your team can consider the problem handled.", }, { before: "Each part below is explained in order. We begin with the address pools your messages originate from, then how abusive senders are filtered, the relationships we keep with provider teams, the metrics we watch, and our plan for when Northwind itself is down.", }, { before: "Curious about the details? Keep scrolling." }, ]; const [active, setActive] = useState(sections[0]?.id); const [visible, setVisible] = useState(false); useEffect(() => { const onScroll = () => setVisible(window.scrollY > 40); onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); const els = sections.map((s) => document.getElementById(s.id)).filter(Boolean) as HTMLElement[]; const io = new IntersectionObserver( (entries) => entries.forEach((e) => e.isIntersecting && setActive(e.target.id)), { rootMargin: "-40% 0px -50% 0px" } ); els.forEach((el) => io.observe(el)); return () => { window.removeEventListener("scroll", onScroll); io.disconnect(); }; }, [sections]); return ( <section className="relative bg-background px-6 py-24 font-sans text-muted-foreground"> <nav aria-label="Sections" className={`fixed bottom-6 left-1/2 z-20 flex -translate-x-1/2 gap-1 rounded-full border border-border bg-card/80 p-1 shadow-obsidian-card-soft backdrop-blur transition-opacity duration-500 ${visible ? "opacity-100" : "pointer-events-none opacity-0"}`} > {sections.map((s) => ( <a key={s.id} href={`#${s.id}`} className={`rounded-full px-4 py-1.5 text-obsidian-ui transition-colors duration-obsidian-hover-color ease-obsidian-hover-color focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${active === s.id ? "bg-muted text-foreground" : "text-muted-foreground hover:text-foreground"}`} > {s.label} </a> ))} </nav> <div className="mx-auto max-w-[600px]"> <Reveal from="up"> <h2 className=" bg-clip-text text-center font-sans text-obsidian-h2 text-transparent">{heading}</h2> </Reveal> <div className="mt-16 space-y-5 text-[16px] leading-[27px]"> {paragraphs.map((p, i) => ( <Reveal key={i} from="up" delay={i * 60}> <p id={sections[i]?.id}> {p.before} {p.highlight && <span className="font-medium text-foreground">{p.highlight}</span>} {p.after} </p> </Reveal> ))} </div> </div> <div className="h-40" /> </section> ); } // ---- Yoink motion (inlined, no dependencies): Reveal ---- const YK_EASE = "cubic-bezier(0.16, 1, 0.3, 1)"; const useYkLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect; function ykReducedMotion(): boolean { return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches; } // "idle": untouched (visible) · "hidden": waiting below the fold · "shown": play the entrance. // Content is only hidden once we know we can show it again (IntersectionObserver exists, motion allowed, // and there is a box to watch), and a safety net reveals anything on screen that is still hidden. type YkRevealState = "idle" | "hidden" | "shown"; function useYkReveal(ref: RefObject<Element | null>, once = true): YkRevealState { const [state, setState] = useState<YkRevealState>("idle"); useYkLayoutEffect(() => { const el = ref.current; if (!el || ykReducedMotion() || typeof IntersectionObserver === "undefined") return; // watch the element's own box, or its children when it has none (display: contents) const boxes = () => (getComputedStyle(el).display === "contents" ? Array.from(el.children) : [el]); const onScreen = (t: Element) => { const r = t.getBoundingClientRect(); return (r.width > 0 || r.height > 0) && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth; }; if (!boxes().some((t) => t.getBoundingClientRect().width > 0 || t.getBoundingClientRect().height > 0)) return; // e.g. hidden at mount: leave it visible let shown = false; const show = (v: boolean) => { if (v !== shown) (shown = v), setState(v ? "shown" : "hidden"); }; setState("hidden"); const inView = new Set<Element>(); const io = new IntersectionObserver((entries) => { for (const e of entries) { if (e.isIntersecting) inView.add(e.target); else inView.delete(e.target); } if (inView.size) { show(true); if (once) io.disconnect(); } else if (!once) show(false); }); const watched = new Set<Element>(); const watch = () => boxes().forEach((t) => !watched.has(t) && (watched.add(t), io.observe(t))); watch(); // safety net: styles that land after mount (display: contents) get watched too, and nothing // stays hidden for more than a moment while it is actually on screen const start = Date.now(); const net = setInterval(() => { if (shown) return once && clearInterval(net); watch(); if (Date.now() - start > 2400 && boxes().some(onScreen)) show(true); }, 600); return () => { io.disconnect(); clearInterval(net); }; }, [once]); return state; } type YkRevealFrom = "up" | "down" | "left" | "right" | "scale" | "blur" | "none"; /** Fades content in as it scrolls into view. */ function Reveal({ children, from = "up", delay = 0, duration = 700, distance = 24, once = true, as = "div", className, style, }: { children?: ReactNode; from?: YkRevealFrom; delay?: number; duration?: number; distance?: number; once?: boolean; as?: ElementType; className?: string; style?: CSSProperties; }) { const Tag = as; const ref = useRef<HTMLElement>(null); const state = useYkReveal(ref, once); const hidden = state === "hidden"; const offset = { up: `translate3d(0, ${distance}px, 0)`, down: `translate3d(0, ${-distance}px, 0)`, left: `translate3d(${-distance}px, 0, 0)`, right: `translate3d(${distance}px, 0, 0)`, scale: "scale(0.94)", blur: `translate3d(0, ${distance / 2}px, 0)`, none: "none", }[from]; const t = `${duration}ms ${YK_EASE} ${delay}ms`; return ( <Tag ref={ref} className={className} style={{ ...style, ...(hidden && { opacity: 0, transform: offset, filter: from === "blur" ? "blur(12px)" : undefined }), ...(state === "shown" && { transition: `opacity ${t}, transform ${t}, filter ${t}` }), }} > {children} </Tag> ); }
Quality checks
Automated, in a real browser · 5d ago- Accessible: passedNo serious accessibility problems (axe-core): readable contrast, labelled buttons and images.
- Responsive: passedRenders at phone (390px), tablet (768px) and desktop width without sideways scrolling.
- Dark mode: passedStill readable when installed in your theme and switched to dark mode.
- Themeable: passedUses design tokens rather than hard-coded colours, so it follows your theme cleanly.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.