Motion & effects / Text effects

Pixel-Icon Section Heading

Very large light condensed section title in cobalt-deep with a tiny pixel-art icon set as a superscript and an optional right-aligned small link, sitting above dotted hairlines.

Rebuilt from hermes-agent.nousresearch.com in the Electric Ultramarine Engraving style.

npx shadcn@latest add https://justyoink.it/r/electric-ultramarine-engraving/blocks/paper-cobalt-section-heading.json

Looks exactly like hermes-agent.nousresearch.com: brings its fonts and colours, namespaced so your own theme stays untouched.

Usage

Props: title, linkLabel, linkHref, and items (array of {q}). The heading fades up on scroll; the pixel icon is an inline SVG superscript.

components/paper-cobalt-section-heading.tsx
"use client";

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

export default function PixelIconSectionHeading({
  title = "Questions",
  linkLabel = "Read guides",
  linkHref = "#",
  items = [
    { q: "How are plans billed?" },
    { q: "Where do I begin?" },
    { q: "Can I invite my team?" },
    { q: "Is my history kept across visits?" },
    { q: "What happens when I pause a workspace?" },
  ],
}: {
  title?: string;
  linkLabel?: string;
  linkHref?: string;
  items?: Item[];
}) {
  return (
    <section className="bg-paper px-6 py-12 text-cobalt-deep">
      <div className="mx-auto max-w-[1080px]">
        <Reveal from="up" distance={16} duration={800}>
          <div className="flex items-start justify-between pb-3">
            <h2 className="font-display text-[72px] font-light leading-none tracking-[-0.01em] md:text-[104px]">
              {title}
              <sup className="ml-2 inline-block align-super">
                <svg width="16" height="18" viewBox="0 0 8 9" shapeRendering="crispEdges" aria-hidden="true" className="fill-cobalt">
                  <path d="M1 0h4v1h1v1h1v7H1zM2 3v1h4V3zm0 2v1h4V5zm0 2v1h3V7z" fillRule="evenodd" />
                </svg>
              </sup>
            </h2>
            <a
              href={linkHref}
              className="mt-6 font-display text-[13px] font-light uppercase tracking-wide underline underline-offset-2 decoration-cobalt-deep/30 transition-colors duration-link-underline hover:decoration-cobalt-deep focus-visible:outline focus-visible:outline-2 focus-visible:outline-cobalt"
            >
              {linkLabel}
            </a>
          </div>
        </Reveal>
        <ul className="border-t border-dotted border-cobalt-deep">
          {items.map((it) => (
            <li key={it.q} className="border-b border-dotted border-cobalt-deep">
              <button className="flex w-full items-center justify-between py-5 text-left font-display text-[28px] font-light text-cobalt focus-visible:outline focus-visible:outline-2 focus-visible:outline-cobalt">
                <span>{it.q}</span>
                <span aria-hidden="true" className="font-mono text-sm">+</span>
              </button>
            </li>
          ))}
        </ul>
      </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 · 5d ago
—

More from Electric Ultramarine Engraving

The whole style →

Numbered Engraving Feature Grid

Feature sections

Weathered Texture Compare Hero

Heroes

Cobalt Engraving Hero

Heroes

Spaced Mono Navigation Bar

Headers & nav bars

Install Command Tabs

Code blocks

Condensed Uppercase Button Pair

Buttons