Page sections / Blog & articles

Full-bleed Story Tile Mosaic

2×2 mosaic of 16:10 rounded customer-site screenshots, edge to edge with tiny gutters, each a bold colorful full-bleed photo or poster with oversized type; they carry the color while the chrome stays black.

Rebuilt from framer.com/stories in the Obsidian Canvas style.

npx shadcn@latest add https://justyoink.it/r/obsidian-canvas-cc37fa/blocks/story-tile-mosaic.json

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

Images4 in this component. Swap any for a library image or one of your own.All images in this style →

Choose an image

Image

Loading…

Usage

Optional props imageA–imageD swap the photo slots (defaults are stock URLs). Tiles slide in from the sides on scroll and scale slightly on hover.

components/story-tile-mosaic.tsx
"use client";

import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
type Props = {
  imageA?: string;
  imageB?: string;
  imageC?: string;
  imageD?: string;
};

const tile = "group relative aspect-[16/10] overflow-hidden rounded-xl bg-surface";
const zoom = "h-full w-full transition-transform duration-surface-hover ease-surface-hover group-hover:scale-[1.03]";

export default function StoryTileMosaic({
  imageA = "https://yoink-app.fly.dev/stock/people-6.jpg",
  imageB = "https://yoink-app.fly.dev/stock/city-3.jpg",
  imageC = "https://yoink-app.fly.dev/stock/landscape-2.jpg",
  imageD = "https://yoink-app.fly.dev/stock/abstract-3.jpg",
}: Props) {
  return (
    <section className="bg-canvas p-1 text-primary">
      <div className="grid grid-cols-1 gap-1 md:grid-cols-2">
        <Reveal from="left" duration={1400} distance={80}>
          <a href="#" className={tile + " block focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-blue"} aria-label="Story one">
            <div className={zoom}>
              <img src={imageA} alt="Hands holding a film camera" width={720} height={450} loading="lazy" className="h-full w-full object-cover" />
            </div>
            <div className="absolute inset-0 bg-[linear-gradient(90deg,transparent_40%,rgba(120,230,255,0.25))]" />
            <p className="absolute right-4 top-6 text-right font-display text-[clamp(2.5rem,7vw,5.5rem)] font-semibold uppercase leading-[0.9] text-[#7ee8ff]">Hello,<br />oh,<br />hello</p>
          </a>
        </Reveal>
        <Reveal from="right" duration={1400} distance={80}>
          <a href="#" className={tile + " block bg-[#ee4d43] focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-blue"} aria-label="Story two">
            <div className="absolute inset-0 bg-[#ee4d43]" />
            <div className={"absolute inset-0 p-4 " + zoom}>
              <p className="font-display text-lg font-semibold leading-tight text-black">Field Guide<br />to the City</p>
              <div className="absolute inset-x-4 bottom-12 h-px bg-black/40" />
              <p className="absolute bottom-4 left-4 font-display text-[clamp(2.5rem,8vw,6rem)] font-bold leading-[0.85] tracking-[-0.04em] text-black">Harbor<br />Lines</p>
              <img src={imageB} alt="Aerial city" width={180} height={160} loading="lazy" className="absolute bottom-4 right-0 h-1/3 w-1/4 object-cover" />
            </div>
          </a>
        </Reveal>
        <Reveal from="left" duration={1400} distance={80} delay={100}>
          <a href="#" className={tile + " block focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-blue"} aria-label="Story three">
            <div className={zoom}>
              <img src={imageC} alt="Snowy mountains" width={720} height={450} loading="lazy" className="h-full w-full object-cover" />
            </div>
            <div className="absolute inset-0 bg-scrim/30" />
            <h3 className="absolute inset-x-0 top-1/3 px-8 text-center font-display text-[clamp(1.75rem,4.5vw,3.5rem)] font-medium leading-[1] tracking-[-0.03em] text-white">A studio built to climb higher</h3>
            <span className="absolute bottom-4 left-1/2 -translate-x-1/2 rounded-full bg-black/40 px-3 py-1 text-caption text-white">Watch Reel</span>
          </a>
        </Reveal>
        <Reveal from="right" duration={1400} distance={80} delay={100}>
          <a href="#" className={tile + " block bg-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent-blue"} aria-label="Story four">
            <div className={zoom + " relative"}>
              <div className="absolute inset-x-0 top-0 h-[60%] bg-[linear-gradient(120deg,#ff7a4d,#c9a8ff_40%,#9fd8c0_60%,#f3a07a)]" />
              <img src={imageD} alt="" width={720} height={450} loading="lazy" className="absolute inset-x-0 top-0 h-[60%] w-full object-cover opacity-40 mix-blend-multiply" />
              <p className="absolute left-3 top-[64%] max-w-[35%] text-[11px] leading-snug text-black">How teams are shaping their craft with new tools</p>
              <p className="absolute bottom-4 right-4 w-1/2 font-display text-[clamp(1.75rem,5vw,4rem)] font-semibold leading-[0.95] tracking-[-0.04em] text-black">Craft Report 2030</p>
            </div>
          </a>
        </Reveal>
      </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 Obsidian Canvas

The whole style →

Minimal Black Header

Headers & nav bars

Platform Bento Grid

Feature sections

Audience Icon Grid

Feature sections

Sticky-date Changelog Entry

Changelog

Neon Agent Prompt Hero

Heroes

Hairline Triple Feature Strip

Feature sections