Numbered Rule Section Header
Editorial section opener used on approach and labs pages: a thin 1px forest-green rule across the top, a light large numeral (01–05) at the left and a centered 48px section title on white.
Rebuilt from seed.com/approach in the Verdant Lab Editorial style.
Looks exactly like seed.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
All text is exposed as props (numeral, title, caption, leftHeading, leftBody, rightHeading, rightBody, linkLabel) with defaults, so it renders with no props. The heat-map figure is drawn in inline SVG; replace it with your own chart or image if needed.
components/numbered-section-header.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; export default function NumberedRuleSectionHeader({ numeral = "01", title = "Cultures", caption = "Fig.1 - Relative density by flow cytometry for sample XR-7", leftHeading = "Culture Bank Verification", leftBody = "Our culture library holds organisms with deep laboratory and field records produced at partner universities and institutes across several continents. Every isolate is catalogued and stored in a public repository for independent review.", rightHeading = "Evidence-Based Amounts", rightBody = "We choose each culture by published findings and keep the effective amount intact in every batch. We also confirm that the stated count remains present through the full storage window, even under harsh transit conditions.", linkLabel = "View Catalogue", }: { numeral?: string; title?: string; caption?: string; leftHeading?: string; leftBody?: string; rightHeading?: string; rightBody?: string; linkLabel?: string; }) { return ( <section className="bg-pure-white text-ink font-sans px-4 md:px-[50px] pb-24"> <div className="border-t border-ink" /> <Reveal from="up"> <header className="relative pt-4 md:h-[150px]"> <span className="block text-[56px] md:text-[64px] font-light leading-none">{numeral}</span> <h2 className="mt-2 md:mt-0 md:absolute md:left-1/2 md:top-4 md:-translate-x-1/2 text-[40px] md:text-[48px] font-light leading-none">{title}</h2> </header> </Reveal> <figure> <div className="relative aspect-[1.91/1] w-full overflow-hidden bg-surface"> <svg viewBox="0 0 1340 700" className="absolute inset-0 h-full w-full" preserveAspectRatio="xMidYMid slice" role="img" aria-label="Density heat map with three clusters"> <defs> <radialGradient id="hm"> <stop offset="0" stopColor="#e8391f" /> <stop offset="0.35" stopColor="#f5a623" /> <stop offset="0.6" stopColor="#9acd32" /> <stop offset="0.8" stopColor="#1fa3d8" /> <stop offset="1" stopColor="#1a2bd0" stopOpacity="0" /> </radialGradient> </defs> <rect width="1340" height="700" fill="#f8f8f8" /> <ellipse cx="430" cy="240" rx="260" ry="130" fill="url(#hm)" /> <ellipse cx="720" cy="490" rx="260" ry="170" fill="url(#hm)" /> <ellipse cx="1030" cy="380" rx="260" ry="260" fill="url(#hm)" transform="rotate(30 1030 380)" /> </svg> </div> <figcaption className="mt-4 text-caption text-ink"><em>{caption.split(" - ")[0]}</em>{" - " + caption.split(" - ").slice(1).join(" - ")}</figcaption> </figure> <div className="mt-16 grid gap-12 md:grid-cols-2 md:pl-[100px]"> <Reveal from="up"> <h3 className="text-[28px] font-light leading-[33px] max-w-[300px]">{leftHeading}</h3> <p className="mt-8 text-body max-w-[350px]">{leftBody}</p> <a href="#" className="mt-8 inline-flex items-center gap-3 text-label font-medium focus-visible:outline focus-visible:outline-2 focus-visible:outline-ink"> <span className="grid h-[26px] w-[26px] place-items-center rounded-pill border border-ink"> <svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor"><path d="M6 0v12M0 6h12" /></svg> </span> {linkLabel} </a> </Reveal> <Reveal from="up" delay={120}> <h3 className="text-[28px] font-light leading-[33px] max-w-[300px]">{rightHeading}</h3> <p className="mt-8 text-body max-w-[345px]">{rightBody}</p> </Reveal> </div> </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 { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; export default function NumberedRuleSectionHeader({ numeral = "01", title = "Cultures", caption = "Fig.1 - Relative density by flow cytometry for sample XR-7", leftHeading = "Culture Bank Verification", leftBody = "Our culture library holds organisms with deep laboratory and field records produced at partner universities and institutes across several continents. Every isolate is catalogued and stored in a public repository for independent review.", rightHeading = "Evidence-Based Amounts", rightBody = "We choose each culture by published findings and keep the effective amount intact in every batch. We also confirm that the stated count remains present through the full storage window, even under harsh transit conditions.", linkLabel = "View Catalogue", }: { numeral?: string; title?: string; caption?: string; leftHeading?: string; leftBody?: string; rightHeading?: string; rightBody?: string; linkLabel?: string; }) { return ( <section className="bg-muted text-foreground font-sans px-4 md:px-[50px] pb-24"> <div className="border-t border-foreground" /> <Reveal from="up"> <header className="relative pt-4 md:h-[150px]"> <span className="block text-[56px] md:text-[64px] font-light leading-none">{numeral}</span> <h2 className="mt-2 md:mt-0 md:absolute md:left-1/2 md:top-4 md:-translate-x-1/2 text-[40px] md:text-[48px] font-light leading-none">{title}</h2> </header> </Reveal> <figure> <div className="relative aspect-[1.91/1] w-full overflow-hidden bg-card"> <svg viewBox="0 0 1340 700" className="absolute inset-0 h-full w-full" preserveAspectRatio="xMidYMid slice" role="img" aria-label="Density heat map with three clusters"> <defs> <radialGradient id="hm"> <stop offset="0" stopColor="#e8391f" /> <stop offset="0.35" stopColor="#f5a623" /> <stop offset="0.6" stopColor="#9acd32" /> <stop offset="0.8" stopColor="#1fa3d8" /> <stop offset="1" stopColor="#1a2bd0" stopOpacity="0" /> </radialGradient> </defs> <rect width="1340" height="700" fill="#f8f8f8" /> <ellipse cx="430" cy="240" rx="260" ry="130" fill="url(#hm)" /> <ellipse cx="720" cy="490" rx="260" ry="170" fill="url(#hm)" /> <ellipse cx="1030" cy="380" rx="260" ry="260" fill="url(#hm)" transform="rotate(30 1030 380)" /> </svg> </div> <figcaption className="mt-4 text-verdant-caption text-foreground"><em>{caption.split(" - ")[0]}</em>{" - " + caption.split(" - ").slice(1).join(" - ")}</figcaption> </figure> <div className="mt-16 grid gap-12 md:grid-cols-2 md:pl-[100px]"> <Reveal from="up"> <h3 className="text-[28px] font-light leading-[33px] max-w-[300px]">{leftHeading}</h3> <p className="mt-8 text-verdant-body max-w-[350px]">{leftBody}</p> <a href="#" className="mt-8 inline-flex items-center gap-3 text-verdant-label font-medium focus-visible:outline focus-visible:outline-2 focus-visible:outline-foreground"> <span className="grid h-[26px] w-[26px] place-items-center rounded-full border border-foreground"> <svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor"><path d="M6 0v12M0 6h12" /></svg> </span> {linkLabel} </a> </Reveal> <Reveal from="up" delay={120}> <h3 className="text-[28px] font-light leading-[33px] max-w-[300px]">{rightHeading}</h3> <p className="mt-8 text-verdant-body max-w-[345px]">{rightBody}</p> </Reveal> </div> </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 · 4d 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: not passed1 hard-coded colour (#f8f8f8). These ignore the theme and break dark mode.
- Animates cleanly: passedIts animation plays and finishes with everything visible, and it stays still for people who turn on reduced motion.