Circular Diagram Method Rows
Alternating rows with a circular-masked scientific graphic (contour plot, genome ring, face collage) on the left and subhead plus paragraph on the right, divided by dotted hairlines.
Rebuilt from seed.com/approach in the Verdant Lab Editorial style.
npx shadcn@latest add https://justyoink.it/r/verdant-lab-editorial/blocks/circle-masked-method-rows.json
Looks exactly like seed.com: brings its fonts and colours, namespaced so your own theme stays untouched.
npx shadcn@latest add https://justyoink.it/r/verdant-lab-editorial/mine/circle-masked-method-rows.json
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
Pass `number`, `heading` and a `rows` array of {title, body, kind} where kind is "contour", "ring" or "photos". Each circular graphic is drawn in code and fades up on scroll.
components/circle-masked-method-rows.tsx
"use client"; import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react"; type Row = { title: string; body: string; kind: "contour" | "ring" | "photos" }; const DEFAULT_ROWS: Row[] = [ { title: "Particle Counting", body: "Samples are gently labeled with light-reactive tags and passed through a narrow channel, where a detector tallies every cell. This gives a fuller picture of living, stressed and inactive material than a classic plate count can offer on its own.", kind: "contour" }, { title: "Full Sequence Mapping", body: "Every culture is read from end to end with long-read and short-read methods, so each strain and species can be confirmed against its reference with confidence.", kind: "ring" }, { title: "Field Studies", body: "We work alongside university partners to test our formulas in controlled, blinded trials, pairing human outcomes with laboratory data gathered along the way.", kind: "photos" }, ]; function Contour() { const l = ["#e8eec9", "#cdd9ad", "#b5c797", "#9bb57d", "#6f9a4a", "#4a6e2c", "#27381a", "#10140c"]; return ( <svg viewBox="0 0 100 100" className="h-full w-full" aria-hidden="true"> <rect width="100" height="100" fill="var(--color-lemongrass)" opacity="0.5" /> {l.slice(1).map((c, i) => ( <g key={i}> <ellipse cx={38 - i * 0.5} cy={64 - i * 0.5} rx={24 - i * 3} ry={30 - i * 3.6} transform="rotate(25 38 64)" fill={c} /> <ellipse cx={67 + i * 0.5} cy={26} rx={16 - i * 2.4} ry={11 - i * 1.6} fill={c} opacity={i > 4 ? 0 : 0.8} /> </g> ))} <path d="M40 60 C45 40 55 35 62 28" stroke="#cdd9ad" strokeWidth="10" fill="none" opacity="0.6" /> </svg> ); } function Ring() { const rings = [ [47, "#f5d90a", 3], [40, "#3fb0f0", 5], [32, "#3d6b1f", 5], [26, "#d9860a", 5], [20, "#e0156a", 4], [14, "#8a4fa8", 2], ] as const; return ( <svg viewBox="0 0 100 100" className="h-full w-full" aria-hidden="true"> <circle cx="50" cy="50" r="43.5" fill="none" stroke="#1d4a54" strokeWidth="5" strokeDasharray="0.6 0.8" /> {rings.map(([r, c, w], i) => ( <circle key={i} cx="50" cy="50" r={r} fill="none" stroke={c} strokeWidth={w} /> ))} </svg> ); } function Photos() { const tones = ["#5a3a2c", "#7a4a36", "#b87a5a", "#d9a58a", "#a86a4c", "#e8d2bc"]; return ( <div className="grid h-full w-full grid-cols-3 grid-rows-2" aria-hidden="true"> {tones.map((t, i) => ( <div key={i} className="relative" style={{ background: `linear-gradient(135deg, ${t}, #2a1a14)` }}> <div className="absolute left-1/4 top-1/4 h-1/2 w-1/2 rounded-full opacity-40" style={{ background: t, filter: "blur(10px)" }} /> </div> ))} </div> ); } export default function CircularDiagramMethodRows({ number = "03", heading = "Verification", rows = DEFAULT_ROWS }: { number?: string; heading?: string; rows?: Row[] }) { return ( <section className="bg-canvas px-5 text-ink md:px-[50px]"> <div className="grid grid-cols-1 border-t border-ink pt-4 md:grid-cols-[1fr_auto_1fr]"> <span className="text-h1 font-light">{number}</span> <h2 className="text-h1 font-light">{heading}</h2> <span /> </div> <div className="mt-12"> {rows.map((r, i) => ( <div key={i} className="grid items-center gap-8 border-b border-dotted border-hairline py-12 last:border-0 md:grid-cols-2 md:py-[50px]"> <Reveal from="up" className="mx-auto aspect-square w-full max-w-[470px] overflow-hidden rounded-full md:mx-0 md:ml-[100px]"> {r.kind === "contour" ? <Contour /> : r.kind === "ring" ? <Ring /> : <Photos />} </Reveal> <div className="max-w-[470px]"> <h3 className="text-h2 font-light">{r.title}</h3> <p className="mt-5 text-body">{r.body}</p> </div> </div> ))} </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"; type Row = { title: string; body: string; kind: "contour" | "ring" | "photos" }; const DEFAULT_ROWS: Row[] = [ { title: "Particle Counting", body: "Samples are gently labeled with light-reactive tags and passed through a narrow channel, where a detector tallies every cell. This gives a fuller picture of living, stressed and inactive material than a classic plate count can offer on its own.", kind: "contour" }, { title: "Full Sequence Mapping", body: "Every culture is read from end to end with long-read and short-read methods, so each strain and species can be confirmed against its reference with confidence.", kind: "ring" }, { title: "Field Studies", body: "We work alongside university partners to test our formulas in controlled, blinded trials, pairing human outcomes with laboratory data gathered along the way.", kind: "photos" }, ]; function Contour() { const l = ["#e8eec9", "#cdd9ad", "#b5c797", "#9bb57d", "#6f9a4a", "#4a6e2c", "#27381a", "#10140c"]; return ( <svg viewBox="0 0 100 100" className="h-full w-full" aria-hidden="true"> <rect width="100" height="100" fill="var(--color-muted)" opacity="0.5" /> {l.slice(1).map((c, i) => ( <g key={i}> <ellipse cx={38 - i * 0.5} cy={64 - i * 0.5} rx={24 - i * 3} ry={30 - i * 3.6} transform="rotate(25 38 64)" fill={c} /> <ellipse cx={67 + i * 0.5} cy={26} rx={16 - i * 2.4} ry={11 - i * 1.6} fill={c} opacity={i > 4 ? 0 : 0.8} /> </g> ))} <path d="M40 60 C45 40 55 35 62 28" stroke="#cdd9ad" strokeWidth="10" fill="none" opacity="0.6" /> </svg> ); } function Ring() { const rings = [ [47, "#f5d90a", 3], [40, "#3fb0f0", 5], [32, "#3d6b1f", 5], [26, "#d9860a", 5], [20, "#e0156a", 4], [14, "#8a4fa8", 2], ] as const; return ( <svg viewBox="0 0 100 100" className="h-full w-full" aria-hidden="true"> <circle cx="50" cy="50" r="43.5" fill="none" stroke="#1d4a54" strokeWidth="5" strokeDasharray="0.6 0.8" /> {rings.map(([r, c, w], i) => ( <circle key={i} cx="50" cy="50" r={r} fill="none" stroke={c} strokeWidth={w} /> ))} </svg> ); } function Photos() { const tones = ["#5a3a2c", "#7a4a36", "#b87a5a", "#d9a58a", "#a86a4c", "#e8d2bc"]; return ( <div className="grid h-full w-full grid-cols-3 grid-rows-2" aria-hidden="true"> {tones.map((t, i) => ( <div key={i} className="relative" style={{ background: `linear-gradient(135deg, ${t}, #2a1a14)` }}> <div className="absolute left-1/4 top-1/4 h-1/2 w-1/2 rounded-full opacity-40" style={{ background: t, filter: "blur(10px)" }} /> </div> ))} </div> ); } export default function CircularDiagramMethodRows({ number = "03", heading = "Verification", rows = DEFAULT_ROWS }: { number?: string; heading?: string; rows?: Row[] }) { return ( <section className="bg-background px-5 text-foreground md:px-[50px]"> <div className="grid grid-cols-1 border-t border-foreground pt-4 md:grid-cols-[1fr_auto_1fr]"> <span className="text-verdant-h1 font-light">{number}</span> <h2 className="text-verdant-h1 font-light">{heading}</h2> <span /> </div> <div className="mt-12"> {rows.map((r, i) => ( <div key={i} className="grid items-center gap-8 border-b border-dotted border-border py-12 last:border-0 md:grid-cols-2 md:py-[50px]"> <Reveal from="up" className="mx-auto aspect-square w-full max-w-[470px] overflow-hidden rounded-full md:mx-0 md:ml-[100px]"> {r.kind === "contour" ? <Contour /> : r.kind === "ring" ? <Ring /> : <Photos />} </Reveal> <div className="max-w-[470px]"> <h3 className="text-verdant-h2 font-light">{r.title}</h3> <p className="mt-5 text-verdant-body">{r.body}</p> </div> </div> ))} </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 passed2 hard-coded colours (#cdd9ad, #1d4a54). 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.