Page sections / Calls to action

Centered Closing CTA with Pill Pair

Huge centered two-line headline on black with a light filled pill 'Get started' and a dark raised pill 'Contact sales' side by side.

Rebuilt from linear.app in the Obsidian Precision style.

npx shadcn@latest add https://justyoink.it/r/obsidian-precision-5cbef2/blocks/closing-cta-pair.json

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

Usage

Pass headlineTop, headlineBottom, primaryLabel/primaryHref and secondaryLabel/secondaryHref to customize copy and links. Renders standalone with defaults.

components/closing-cta-pair.tsx
"use client";

import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
export default function ClosingCtaPillPair({
  headlineTop = "Ship faster.",
  headlineBottom = "Start this week.",
  primaryLabel = "Start free",
  primaryHref = "#",
  secondaryLabel = "Talk to us",
  secondaryHref = "#",
}: {
  headlineTop?: string;
  headlineBottom?: string;
  primaryLabel?: string;
  primaryHref?: string;
  secondaryLabel?: string;
  secondaryHref?: string;
}) {
  return (
    <section className="relative isolate overflow-hidden bg-canvas px-6 py-24 md:py-32">
      <div
        aria-hidden
        className="pointer-events-none absolute inset-x-0 top-0 -z-10 h-64 bg-[radial-gradient(50%_100%_at_50%_0%,var(--color-surface),transparent)] opacity-70"
      />
      <div className="mx-auto flex max-w-4xl flex-col items-center text-center">
        <Reveal from="up">
          <h2 className="font-sans text-[44px] font-medium leading-[1.05] tracking-[-0.04em] text-primary sm:text-[64px] md:text-[80px]">
            {headlineTop}
            <br />
            {headlineBottom}
          </h2>
        </Reveal>
        <Reveal from="up" delay={150}>
          <div className="mt-10 flex flex-wrap items-center justify-center gap-3">
            <a
              href={primaryHref}
              className="inline-flex h-11 items-center rounded-pill bg-button-light px-5 text-ui text-canvas transition-[background-color,filter] duration-[160ms] hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-indigo"
            >
              {primaryLabel}
            </a>
            <a
              href={secondaryHref}
              className="inline-flex h-11 items-center rounded-pill border border-hairline-subtle bg-surface-raised px-5 text-ui text-primary backdrop-blur-[4px] transition-colors duration-[160ms] hover:bg-[#191a1b] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-indigo"
            >
              {secondaryLabel}
            </a>
          </div>
        </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 Precision

The whole style →

Bold Colour Testimonial Cards

Testimonials

Mono Uppercase Feature Tab List with Document Preview

Tab bars

Nested Initiatives Table

Tables

Quarterly Roadmap Board

Cards

Blur-In Word Hero with Floating App Window

Heroes

Frosted Hairline Header

Headers & nav bars