Page sections / Feature sections

Ambient Illustration Feature Split

Two-column feature row alternating sides: tall 3:4 rounded abstract illustration (light beam over horizon on slate, or concentric rings on cream paper) opposite a headline, large gap, and bottom-anchored accordion list with hairline top border.

Rebuilt from mercury.com in the Twilight Ledger style.

npx shadcn@latest add https://justyoink.it/r/twilight-ledger-0e1ecf/blocks/ambient-art-feature-split.json

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

Usage

Props: headline, items (title/body accordion entries), imageOnRight (flip sides). Click a list item to expand it; the illustration is pure CSS and the columns rise in on scroll.

components/ambient-art-feature-split.tsx
"use client";

import { useEffect, useLayoutEffect, useRef, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
import { useState } from "react";

type Item = { title: string; body: string };

export default function AmbientIllustrationFeatureSplit({
  headline = "Open an account today. Keep every day moving.",
  items = [
    { title: "Sign up from your couch in minutes", body: "Create a savings or spending account online with no branch visits, no forms to print and no waiting around." },
    { title: "Spend with a virtual card right away", body: "Your card is ready the moment you are approved, so you can pay for things before the plastic arrives." },
    { title: "Handle routine money tasks quickly", body: "Move funds, split bills and set up recurring transfers in a few taps." },
  ] as Item[],
  imageOnRight = true,
}: {
  headline?: string;
  items?: Item[];
  imageOnRight?: boolean;
}) {
  const [open, setOpen] = useState(0);

  const dots: [number, number][] = [[50, 22], [50, 52], [63, 63], [41, 78], [22, 87], [88, 92]];

  const art = (
    <div className="relative aspect-[4/5] w-full overflow-hidden rounded-xl bg-surface md:aspect-[4/5]">
      <div className="absolute inset-0 bg-[linear-gradient(180deg,#3a3d4d,#2f3140_60%,#4a4658)]" />
      <div className="absolute -bottom-[18%] left-1/2 h-[45%] w-[130%] -translate-x-1/2 rounded-[50%] bg-[radial-gradient(ellipse_at_50%_20%,#c5dde5,#8fa9b8_60%,transparent_75%)] blur-[6px]" />
      <div className="absolute left-1/2 top-[14%] h-[52%] w-[26%] -translate-x-1/2 bg-[linear-gradient(180deg,rgba(220,235,245,0.9),rgba(160,190,205,0.4)_70%,transparent)] [clip-path:polygon(49%_0,51%_0,100%_100%,0_100%)] blur-[1px]" />
      <div className="absolute left-1/2 top-[10%] h-6 w-6 -translate-x-1/2 animate-pulse rounded-full shadow-glow-soft ring-8 ring-white/10" />
      {dots.map(([x, y], i) => (
        <span key={i} className="absolute h-1.5 w-1.5 rounded-full bg-ink" style={{ left: `${x}%`, top: `${y}%` }} />
      ))}
    </div>
  );

  return (
    <section className="bg-canvas px-6 py-20 text-ink">
      <div className="mx-auto grid max-w-6xl gap-10 md:grid-cols-2 md:gap-16">
        <div className={`flex min-h-[420px] flex-col justify-between gap-16 md:min-h-[620px] ${imageOnRight ? "" : "md:order-2"}`}>
          <Reveal from="up" distance={50} duration={670} delay={150}>
            <h2 className="font-display text-h2 text-ink">{headline}</h2>
          </Reveal>
          <ul className="border-t border-hairline">
            {items.map((it, i) => {
              const isOpen = open === i;
              return (
                <li key={it.title} className="border-b border-hairline last:border-b-0">
                  <button
                    type="button"
                    aria-expanded={isOpen}
                    onClick={() => setOpen(i)}
                    className="flex w-full items-start gap-4 py-4 text-left focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent"
                  >
                    <span className={`mt-2 h-1.5 w-1.5 shrink-0 rounded-full transition-colors ${isOpen ? "bg-accent" : "bg-transparent"}`} />
                    <span className="block">
                      <span className={`block text-body ${isOpen ? "text-ink" : "text-ink-muted"}`}>{it.title}</span>
                      <span className={`grid transition-all duration-500 ${isOpen ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"}`}>
                        <span className="overflow-hidden">
                          <span className="block max-w-sm pt-1 text-body text-ink-muted">{it.body}</span>
                        </span>
                      </span>
                    </span>
                  </button>
                </li>
              );
            })}
          </ul>
        </div>
        <Reveal from="up" distance={50} duration={670} delay={150} className={imageOnRight ? "" : "md:order-1"}>
          {art}
        </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 Twilight Ledger

The whole style →

Light Release Notes Header

Changelog

Cinematic Landscape Hero

Heroes

Frosted Transparent Header

Headers & nav bars

Glass Email Capture Pill

Forms

Accordion Feature List with Product Mock

Feature sections

Dark Glass Account Panel Mockup

Media & mockups