Page sections / Feature sections

Editorial Two-Column Copy Block

Content block with an indented grid: a 24px light lead paragraph at the top, then a bold lead-in and 16px body copy columns with 'Probiotic Strain Validation'-style subheads. Ends with a circled plus 'View Taxonomy' outline link.

Rebuilt from seed.com/approach in the Verdant Lab Editorial style.

npx shadcn@latest add https://justyoink.it/r/verdant-lab-editorial/blocks/science-two-column-copy.json

Looks exactly like seed.com: brings its fonts and colours, namespaced so your own theme stays untouched.

Usage

Props: index, heading, caption, and columns (array of {title, body, cta?, href?}); a column with cta shows the circled-plus outline link that fills on hover. The density figure is drawn in inline SVG, so it renders with no props.

components/science-two-column-copy.tsx
"use client";

import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
type Col = { title: string; body: string; cta?: string; href?: string };

export default function EditorialTwoColumnCopyBlock({
  index = "02",
  heading = "Cultures",
  caption = "Fig.2 - Relative density map from a sample sequencing run",
  columns = [
    {
      title: "Culture Library\nVerification",
      body: "Our library holds living cultures backed by thorough laboratory records gathered with university groups and independent research teams across Europe, Asia and the Americas. Each isolate is catalogued and stored in a public collection for traceability.",
      cta: "View Catalogue",
      href: "#",
    },
    {
      title: "Evidence-Based\nPotency",
      body: "We choose every culture from published trial data and keep the effective amount of each one in the finished formula. We also test that viable counts stay at or above the stated level for the full shelf life, even after rough transit conditions.",
    },
  ] as Col[],
}) {
  return (
    <section className="bg-canvas text-ink font-sans px-6 md:px-[50px] py-12">
      <div className="border-t border-ink pt-6 grid grid-cols-1 md:grid-cols-[1fr_2fr] gap-4">
        <span className="text-display font-light">{index}</span>
        <h2 className="text-display font-light md:pl-[calc(50%-4rem)]">{heading}</h2>
      </div>

      <Reveal from="up">
        <figure className="mt-16">
          <div className="relative aspect-[1.91/1] overflow-hidden bg-surface">
            <svg viewBox="0 0 400 210" className="absolute inset-0 h-full w-full" preserveAspectRatio="xMidYMid slice" aria-label="Density map" role="img">
              <defs>
                <radialGradient id="hot">
                  <stop offset="0" stopColor="#e8321c" />
                  <stop offset="0.35" stopColor="#f5a623" />
                  <stop offset="0.6" stopColor="#7cb342" />
                  <stop offset="0.8" stopColor="#1e88e5" />
                  <stop offset="1" stopColor="#1e88e5" stopOpacity="0" />
                </radialGradient>
              </defs>
              <rect width="400" height="210" fill="#fafafa" />
              <ellipse cx="120" cy="100" rx="70" ry="38" fill="url(#hot)" />
              <ellipse cx="240" cy="150" rx="70" ry="50" fill="url(#hot)" />
              <ellipse cx="300" cy="120" rx="60" ry="70" fill="url(#hot)" transform="rotate(30 300 120)" />
            </svg>
          </div>
          <figcaption className="mt-4 text-caption"><em>{caption.split(" - ")[0]}</em> - {caption.split(" - ")[1]}</figcaption>
        </figure>
      </Reveal>

      <div className="mt-14 md:pl-[100px] grid grid-cols-1 md:grid-cols-2 gap-12 md:gap-x-16">
        {columns.map((c) => (
          <div key={c.title} className="max-w-[360px]">
            <h3 className="text-h3 font-light whitespace-pre-line">{c.title}</h3>
            <p className="mt-8 text-body">{c.body}</p>
            {c.cta && (
              <a href={c.href} className="group mt-10 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 transition-all duration-[250ms] group-hover:bg-ink group-hover:text-canvas">
                  <svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" aria-hidden="true"><path d="M7 1v12M1 7h12" /></svg>
                </span>
                {c.cta}
              </a>
            )}
          </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
—

More from Verdant Lab Editorial

The whole style →

Center-Focus Video Story Carousel

Carousels

Hairline Plus Accordion

Accordions

Frosted Glass Photo Hero

Heroes

Offer Popup Dialog

Dialogs & modals

Timeline Benefit Tiles

Feature sections

Glass Panel Annotated Capsule

Feature sections