Page sections / Feature sections

Four-Up Surface Cards

Four equal columns of surface-tint cards with title, muted description, orange link and a cropped illustrated screenshot (desktop, CLI, Slack, mobile) in a stone well that bleeds off the right edge.

Rebuilt from cursor.com/product in the Warm Paper Editorial style.

npx shadcn@latest add https://justyoink.it/r/warm-paper-editorial/blocks/surface-quad-grid.json

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

Usage

Props: heading, subheading, and cards (array of {title, text, cta, external}). Renders four cards with built-in miniature UI mockups that are cropped on the right edge; works with no props.

components/surface-quad-grid.tsx
"use client";

import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
type Card = { title: string; text: string; cta: string; external?: boolean };

type Props = {
  heading?: string;
  subheading?: string;
  cards?: Card[];
};

const defaults: Card[] = [
  { title: "Editor", text: "Plan and write code with an assistant, right inside your editor.", cta: "Get the app" },
  { title: "Terminal", text: "Run tasks from any shell, script, or pipeline.", cta: "Install" },
  { title: "Chat Apps", text: "Kick off jobs from team chat, trackers, and issue boards.", cta: "Connect chat", external: true },
  { title: "Web & Phone", text: "Launch hosted tasks from any browser or handset.", cta: "Open web app", external: true },
];

function Chrome() {
  return (
    <div className="flex gap-1.5 px-3 py-2.5">
      {[0, 1, 2].map((i) => (
        <span key={i} className="h-2.5 w-2.5 rounded-pill bg-hairline" />
      ))}
    </div>
  );
}

function Win({ children }: { children: React.ReactNode }) {
  return (
    <div className="absolute left-6 top-6 w-[110%] overflow-hidden rounded-lg bg-surface shadow-window">
      <Chrome />
      {children}
    </div>
  );
}

function Visual({ i }: { i: number }) {
  if (i === 0)
    return (
      <Win>
        <div className="space-y-2 px-3 pb-24 font-sans text-product-micro text-ink">
          <div className="rounded-md border border-hairline px-2 py-1.5">add a quick filter menu</div>
          <p className="text-ink-faint">Read List.tsx, Menu.tsx</p>
          <p className="text-ink-faint">Searched filter handlers</p>
          <p className="text-ink-faint">Edited Filter.tsx</p>
          <p>Done. Press the shortcut to open filters, then</p>
          <div className="mt-10 rounded-md border border-hairline p-2 text-ink-faint">Ask to plan or build anything</div>
        </div>
      </Win>
    );
  if (i === 1)
    return (
      <Win>
        <div className="space-y-2 px-3 pb-6 font-mono text-product-micro text-ink">
          <p>Helper Agent</p>
          <p className="text-ink-muted">~/work/sample-app</p>
          <p>Data Tools</p>
          <div className="rounded-xs border border-hairline p-2 text-ink-muted">Add pairwise scoring. We only need the basic case but the gap penalty must handle runs.</div>
          <p>● Thought <span className="text-ink-faint">5s</span></p>
          <p>● Read <span className="text-ink-faint">src/align.py, t</span></p>
          <p>● Searched <span className="text-ink-faint">for 'gap penalty'</span></p>
        </div>
      </Win>
    );
  if (i === 2)
    return (
      <Win>
        <div className="space-y-3 px-3 pb-6 text-product-micro text-ink">
          <div className="flex gap-2">
            <span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-pill bg-ink text-canvas">MR</span>
            <div className="w-full rounded-md border border-hairline bg-surface-sunken p-2">
              <p className="text-ink-muted">mrowe 5m ago</p>
              <p className="mt-1">@helper can you review this PR?</p>
            </div>
          </div>
          <div className="flex gap-2">
            <span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-ink text-canvas">
              <span className="h-3 w-3 rotate-45 bg-canvas" />
            </span>
            <div className="w-full rounded-md border border-hairline p-2">
              <p className="text-ink-muted">helper reviewed 3m ago</p>
              <p className="mt-1 font-mono"><span className="text-negative">- </span>{"{mode()}"}</p>
              <p className="font-mono"><span className="text-positive">+ </span>{"{openMode}"}</p>
              <p className="mt-2">Bug: function returns an object instead</p>
            </div>
          </div>
        </div>
      </Win>
    );
  return (
    <div className="absolute left-7 top-6 w-[110%] rounded-[36px] border-[3px] border-ink bg-surface px-4 pt-3">
      <div className="mx-auto h-6 w-24 rounded-pill bg-ink" />
      <div className="mt-5 flex items-center gap-3 text-product-micro">
        <span className="h-5 w-5 rotate-45 rounded-xs bg-ink" />
        <span className="rounded-pill bg-surface-sunken px-2 py-1">Tasks</span>
        <span>Overview</span>
      </div>
      <p className="mt-4 text-product-micro text-ink-muted">Today</p>
      <ul className="mt-2 space-y-3 pb-10 text-product-micro text-ink">
        {[["Streaming update", "Analyzing code"], ["Model picker", "Planning next"], ["Task window", "2 models"], ["Fix send button", "2 files"]].map(([a, b]) => (
          <li key={a}>
            <p>{a}</p>
            <p className="text-ink-muted">{b}</p>
          </li>
        ))}
      </ul>
    </div>
  );
}

export default function FourUpSurfaceCards({
  heading = "Wherever you build",
  subheading = "One assistant for every place you code.",
  cards = defaults,
}: Props) {
  return (
    <section className="bg-canvas px-4 py-16 font-sans text-ink sm:px-8 lg:px-[70px]">
      <div className="mx-auto max-w-[1300px]">
        <h2 className="text-h2">
          {heading}
          <br />
          <span className="text-ink-muted">{subheading}</span>
        </h2>
        <Stagger step={90} from="up" className="mt-12 grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
          {cards.map((c, i) => (
            <article key={c.title} className="flex flex-col rounded-xs border border-hairline bg-surface p-[17px]">
              <h3 className="text-body">{c.title}</h3>
              <p className="mt-1 min-h-[48px] text-body text-ink-muted">{c.text}</p>
              <a href="#" className="mt-5 inline-block self-start text-body text-accent transition-opacity duration-hover-color ease-hover-color hover:opacity-75 focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent">
                {c.cta} {c.external ? "↗" : "→"}
              </a>
              <div className="relative mt-6 h-[378px] overflow-hidden rounded-xs bg-media-stone">
                <Visual i={i % 4} />
              </div>
            </article>
          ))}
        </Stagger>
      </div>
    </section>
  );
}

// ---- Yoink motion (inlined, no dependencies): Stagger ----

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;
}

/** Reveals each direct child one after another when the group scrolls into view. */
function Stagger({
  children,
  step = 90,
  from = "up",
  distance = 20,
  duration = 650,
  delay = 0,
  once = true,
  as = "div",
  className,
  style,
}: {
  children?: ReactNode;
  step?: number;
  from?: "up" | "down" | "left" | "right" | "scale" | "fade";
  distance?: number;
  duration?: number;
  delay?: number;
  once?: boolean;
  as?: ElementType;
  className?: string;
  style?: CSSProperties;
}) {
  const Tag = as;
  const ref = useRef<HTMLElement>(null);
  const state = useYkReveal(ref, once);
  useYkLayoutEffect(() => {
    const items = Array.from(ref.current?.children ?? []) as HTMLElement[];
    if (state === "idle") return;
    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.92)",
      fade: "none",
    }[from];
    if (state === "hidden") {
      for (const el of items) Object.assign(el.style, { transition: "none", opacity: "0", transform: offset });
      return;
    }
    items.forEach((el, i) => {
      const t = `${duration}ms ${YK_EASE} ${delay + i * step}ms`;
      Object.assign(el.style, { transition: `opacity ${t}, transform ${t}`, opacity: "", transform: "" });
    });
    // hand the children their own transitions back once everything has landed
    const done = setTimeout(() => items.forEach((el) => (el.style.transition = "")), delay + items.length * step + duration + 50);
    return () => clearTimeout(done);
  }, [state]);
  return (
    <Tag ref={ref} className={className} style={style}>
      {children}
    </Tag>
  );
}

Quality checks

Automated, in a real browser · 4d ago
—

More from Warm Paper Editorial

The whole style →

Ink and Ghost Pill Buttons

Buttons

Quote Card Grid

Testimonials

Terminal Install Chip

Code blocks

Dated Blog Index Table

Lists

Customer Story Logo Cards

Cards

Hairline Chevron Accordion

FAQ