Page sections / Feature sections

Bordered Mini-UI Feature Grid

3×2 grid of square-cornered hairline cells each containing a miniature code-drawn UI (stacked git-provider tiles, PR bot comment table, commit list, comment bubbles, feature flag search list) fading out at the bottom, with bold lead-in sentence in caption below.

Rebuilt from vercel.com/products/previews in the Monochrome Precision style.

npx shadcn@latest add https://justyoink.it/r/monochrome-precision/blocks/preview-workflow-grid.json

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

Usage

Props: heading, optional subheading, and cells (array of {lead, body}, six used). Each cell's mini-UI is code-drawn and fades out at the bottom; the commit and flag lists stagger in at 290ms.

components/preview-workflow-grid.tsx
"use client";

import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
type Cell = { lead: string; body: string };

const defaultCells: Cell[] = [
  { lead: "Connect.", body: "Link any source host, import a folder, or push from the terminal." },
  { lead: "Review in context.", body: "Each change request spins up its own sandbox, ready for teammates to open the moment it is built." },
  { lead: "Track every release.", body: "A clear history of merges and versions keeps the whole crew aligned on what went out and when." },
  { lead: "Talk it through.", body: "Leave notes directly on the page and resolve threads without leaving the preview." },
  { lead: "Toggle with care.", body: "Search, filter and switch runtime options for any audience." },
  { lead: "Edit together.", body: "Open the live page and adjust copy or layout alongside your team." },
];

type Props = {
  heading?: string;
  subheading?: string;
  cells?: Cell[];
};

const Fade = () => (
  <div className="pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-gradient-to-b from-transparent to-canvas" />
);

const Frame = ({ children }: { children: React.ReactNode }) => (
  <div className="relative h-[250px] overflow-hidden border border-hairline bg-canvas">
    <div className="absolute inset-x-8 top-8 bottom-0">{children}</div>
    <Fade />
  </div>
);

const Avatar = ({ t }: { t: string }) => (
  <span className="inline-flex h-5 w-5 items-center justify-center rounded-pill bg-surface-muted text-[10px] text-ink shadow-ring">{t}</span>
);

function Providers() {
  const marks = ["circle", "tri", "sq", "dia", "term"];
  return (
    <div className="flex h-full items-center justify-center pb-8">
      <div className="flex">
        {marks.map((m, i) => (
          <div key={m} className="-ml-[18px] first:ml-0 flex h-[60px] w-[60px] items-center justify-center rounded-lg border border-hairline bg-surface shadow-card" style={{ zIndex: i }}>
            <svg width="28" height="28" viewBox="0 0 28 28" className="text-ink" fill="currentColor">
              {m === "circle" && <circle cx="14" cy="14" r="11" />}
              {m === "tri" && <path d="M14 3l11 20H3z" />}
              {m === "sq" && <rect x="4" y="4" width="20" height="20" rx="4" />}
              {m === "dia" && <path d="M14 2l12 12-12 12L2 14z" />}
              {m === "term" && <path d="M5 7l8 7-8 7M15 22h9" stroke="currentColor" strokeWidth="3" fill="none" />}
            </svg>
          </div>
        ))}
      </div>
    </div>
  );
}

function BotTable() {
  return (
    <div className="rounded-lg border border-hairline bg-surface text-caption">
      <div className="border-b border-hairline px-4 py-3 text-ink">northbot <span className="mx-1 rounded-xs border border-hairline px-1 text-tertiary">bot</span> <span className="text-secondary">commented just now</span></div>
      <div className="space-y-2 p-4 text-secondary">
        <p><b className="font-medium text-ink">Your build finished successfully.</b> See the details below.</p>
        <div className="grid grid-cols-3 border border-hairline text-tertiary">
          {["Name", "Status", "Result", "web", "Ready", "Visit"].map((c, i) => (
            <div key={i} className="border-b border-r border-hairline px-2 py-1.5 last:border-r-0">{c}</div>
          ))}
        </div>
      </div>
    </div>
  );
}

function Commits() {
  const rows = [
    ["Tidy settings screen", "ui/settings", "2m", "MA"],
    ["Add footer links", "84021-footer", "2h", "JO"],
    ["Drop old banner", "cleanup", "1d", "KI"],
  ];
  return (
    <Stagger step={290} from="up" distance={2} duration={350} className="rounded-lg border border-hairline bg-surface">
      {rows.map((r) => (
        <div key={r[0]} className="flex items-center gap-3 border-b border-hairline px-4 py-3 last:border-b-0">
          <span className="h-8 w-8 shrink-0 rounded-pill border border-hairline" />
          <div className="text-caption">
            <div className="text-ink">{r[0]}</div>
            <div className="flex items-center gap-1.5 text-secondary"><span className="font-mono">{r[1]}</span>{r[2]} ago <Avatar t={r[3]} /></div>
          </div>
        </div>
      ))}
    </Stagger>
  );
}

function Bubbles() {
  return (
    <div className="relative h-full text-caption">
      <div className="absolute left-0 top-0 w-[88%] rounded-lg border border-hairline bg-surface p-3 text-ink">
        <div className="mb-2 flex items-center gap-2"><Avatar t="A" />anna</div>
        Does this heading pass contrast checks? Maybe lighten it.
      </div>
      <div className="absolute right-0 top-[86px] w-[80%] rounded-lg border border-hairline bg-surface p-3 text-ink shadow-card">
        <div className="mb-2 flex items-center gap-2"><Avatar t="L" />leo</div>
        Done, swapped to the darker ink tone.
      </div>
      <span className="absolute left-14 top-[100px] rounded-xs bg-ink px-1.5 py-0.5 text-[10px] text-canvas">Leo</span>
    </div>
  );
}

function Flags() {
  return (
    <div className="rounded-lg border border-hairline bg-surface p-4 text-caption">
      <div className="flex gap-3">
        <div className="flex-1 rounded-md border border-hairline px-3 py-1.5 text-tertiary">Search...</div>
        <div className="rounded-md border border-hairline px-3 py-1.5 text-ink">+ Filter</div>
      </div>
      <Stagger step={290} from="up" distance={2} duration={350} className="mt-4 space-y-3">
        <div className="font-mono text-ink">checkout-new-layout</div>
        <div className="rounded-md border border-hairline px-3 py-1.5 text-ink">Pricing Table ("pricing")</div>
        <div className="font-mono text-tertiary">enable-quick-search</div>
      </Stagger>
    </div>
  );
}

function Blank() {
  return null;
}

export default function BorderedMiniUiFeatureGrid({
  heading = "Connect once. Share everything with your crew.",
  subheading,
  cells = defaultCells,
}: Props) {
  const visuals = [<Providers />, <BotTable />, <Commits />, <Bubbles />, <Flags />, <Blank />];
  return (
    <section className="bg-canvas px-6 py-20 font-sans text-ink">
      <div className="mx-auto max-w-[1392px]">
        <Reveal>
          <h2 className="max-w-xl text-h2 tracking-[-0.03em]">{heading}</h2>
          {subheading && <p className="mt-4 text-secondary">{subheading}</p>}
        </Reveal>
        <div className="mt-16 grid gap-x-6 gap-y-10 md:grid-cols-2 lg:grid-cols-3">
          {cells.slice(0, 6).map((c, i) => (
            <figure key={c.lead} className="m-0">
              <Frame>{visuals[i]}</Frame>
              <figcaption className="mt-10 max-w-[360px] text-lead text-secondary">
                <b className="font-medium text-ink">{c.lead}</b> {c.body}
              </figcaption>
            </figure>
          ))}
        </div>
      </div>
    </section>
  );
}

// ---- Yoink motion (inlined, no dependencies): Reveal, 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;
}

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

/** 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 Monochrome Precision

The whole style →

Ink and Ghost Button Pair

Buttons

Dashed Orbit Integration Ring

Animated graphics

Customer Story Index List

Lists

Centered Quote with Meta Row

Testimonials

Hairline Navigation Bar

Headers & nav bars

Floating Triangle Hero with Logo Strip

Heroes