Page sections / Testimonials

Fading Social Proof Masonry

Centered heading, subline and outlined Discord pill above a five-column staggered masonry of white bordered tweet cards (avatar, handle, X badge, grey body text). The top and bottom edges and outer columns fade out via mask gradients.

Rebuilt from supabase.com in the Emerald Paper Precision style.

npx shadcn@latest add https://justyoink.it/r/emerald-paper-precision/blocks/fading-tweet-masonry.json

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

Usage

Props: heading, subline, ctaLabel, ctaHref, and columns (array of arrays of {handle, body, initials, hue}). Renders standalone with fresh default copy; columns are offset vertically and masked at the edges.

components/fading-tweet-masonry.tsx
"use client";

import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
type Card = { handle: string; body: string; initials: string; hue: string };

type Props = {
  heading?: string;
  subline?: string;
  ctaLabel?: string;
  ctaHref?: string;
  columns?: Card[][];
};

const defaultColumns: Card[][] = [
  [
    { handle: "@marlowkane", initials: "MK", hue: "from-brand-bright to-brand-deep", body: "Setting up the dashboard took an afternoon. Everything felt thoughtful and calm.\n\nThe docs answered nearly every question I had along the way." },
    { handle: "@juniperlee", initials: "JL", hue: "from-amber-code to-violet-code", body: "Shipped our internal tool in a weekend. Fewer moving parts than I expected, honestly." },
  ],
  [
    { handle: "@hollisgrey", initials: "HG", hue: "from-violet-code to-brand", body: "We moved our reporting over last month and nobody on the team has complained once.\n\nQueries are quick, permissions are clear, and onboarding new people is painless.\nA real relief." },
    { handle: "@tessaarden", initials: "TA", hue: "from-brand to-night", body: "Love how readable the whole workflow is. Great for small teams." },
  ],
  [
    { handle: "@ravenoakes", initials: "RO", hue: "from-brand-deep to-brand-bright", body: "The new scheduling feature is a quiet little miracle.\n\nSaves me an hour daily." },
    { handle: "@pellamoss", initials: "PM", hue: "from-amber-code to-brand", body: "Tried it on a side project. Worked first go and the defaults are sensible." },
    { handle: "@wrenfield", initials: "WF", hue: "from-night to-violet-code", body: "Clean interface, fast sync, zero fuss across my devices." },
  ],
  [
    { handle: "@corbinvale", initials: "CV", hue: "from-brand-bright to-violet-code", body: "Our analytics pipeline used to be a tangle. Now a single page tells the whole story, and the alerts only fire when they matter." },
    { handle: "@lioraquill", initials: "LQ", hue: "from-violet-code to-amber-code", body: "Deployed to staging in minutes. Rollbacks are boring, which is exactly what I want.\nHighly recommend for solo builders." },
    { handle: "@dexterhale", initials: "DH", hue: "from-brand to-brand-bright", body: "Support replied within the hour and fixed my odd edge case." },
  ],
  [
    { handle: "@ilsabrook", initials: "IB", hue: "from-amber-code to-brand-deep", body: "The templates are tidy and the search is instant. Makes planning far less stressful for me." },
    { handle: "@gideonfrost", initials: "GF", hue: "from-brand-deep to-night", body: "A week in and I already trust it with client work. Predictable pricing helps too, especially for tiny studios like ours. #buildinpublic" },
    { handle: "@nolatrent", initials: "NT", hue: "from-violet-code to-brand-bright", body: "Honestly just a pleasure to use every day." },
  ],
];

const offsets = ["mt-0", "mt-[60px]", "mt-[100px]", "mt-[60px]", "mt-0"];

export default function FadingSocialProofMasonry({
  heading = "Loved by builders",
  subline = "See what people are saying about working with our platform.",
  ctaLabel = "Chat with us",
  ctaHref = "#",
  columns = defaultColumns,
}: Props) {
  const mask =
    "[mask-image:linear-gradient(to_bottom,black_50%,transparent_100%),linear-gradient(to_right,transparent,black_15%,black_85%,transparent)] [mask-composite:intersect] [-webkit-mask-composite:source-in]";
  return (
    <section className="bg-canvas px-4 py-20 font-sans text-ink">
      <div className="mx-auto max-w-2xl text-center">
        <h2 className="font-display text-h2 tracking-[-0.02em] text-ink">{heading}</h2>
        <p className="mt-4 text-lead text-ink-soft">{subline}</p>
        <a
          href={ctaHref}
          className="mt-6 inline-flex items-center rounded-lg border border-hairline bg-surface px-3 py-1.5 text-label text-ink transition-colors duration-hover-color ease-hover-color hover:border-hairline-strong hover:text-brand focus-visible:outline focus-visible:outline-2 focus-visible:outline-brand"
        >
          {ctaLabel}
        </a>
      </div>
      <div className={`relative mx-auto mt-16 h-[620px] max-w-[1440px] overflow-hidden ${mask}`}>
        <div className="grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-5">
          {columns.map((col, ci) => (
            <Stagger
              key={ci}
              step={440}
              from="fade"
              duration={400}
              delay={ci * 120}
              className={`flex flex-col gap-3 ${offsets[ci % offsets.length]} ${ci > 1 && ci < 4 ? "max-md:hidden" : ""} ${ci === 4 ? "max-lg:hidden" : ""}`}
            >
              {col.map((c) => (
                <figure key={c.handle} className="rounded-xl border border-hairline bg-surface p-4 shadow-card-hairline">
                  <figcaption className="flex items-center gap-3">
                    <span className="relative">
                      <span className={`flex h-10 w-10 items-center justify-center rounded-pill bg-gradient-to-br ${c.hue} text-caption font-medium text-surface`}>
                        {c.initials}
                      </span>
                      <span aria-hidden className="absolute -left-1 -top-1 flex h-4 w-4 items-center justify-center rounded-pill bg-ink text-[9px] leading-none text-surface">
                        ✕
                      </span>
                    </span>
                    <span className="text-label text-ink">{c.handle}</span>
                  </figcaption>
                  <blockquote className="mt-4 whitespace-pre-line text-body text-ink-muted">{c.body}</blockquote>
                </figure>
              ))}
            </Stagger>
          ))}
        </div>
      </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 Emerald Paper Precision

The whole style →

Hairline Site Header

Headers & nav bars

Framework Icon Tab Code Panel

Code blocks

Gradient Customer Story Strip

Testimonials

Compute Pricing Calculator

Forms

Two-Tone Split Hero

Heroes

Hairline Bento Product Grid

Feature sections