Page sections / Calls to action

Polaroid Photo Callout

A left-aligned headline, muted lead paragraph and a button pair, with a slightly rotated off-white polaroid frame holding a grainy photo and a soft shadow on the right. Used for service discovery and the scheduling API.

Rebuilt from cal.com/pricing in the Warm Paper Calendar style.

npx shadcn@latest add https://justyoink.it/r/warm-paper-calendar/blocks/polaroid-image-cta.json

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

ImagesSwap it for a library image or one of your own.All images in this style →

Choose an image

Image

Loading…

Usage

Props: headline (use \n for line break), lead, primaryLabel/secondaryLabel with hrefs, imageSrc and imageAlt. The polaroid's grain is animated via the Grain primitive over the photo.

components/polaroid-image-cta.tsx
"use client";

import { useEffect, useLayoutEffect, useRef, useState, type CSSProperties, type ElementType, type ReactNode, type RefObject } from "react";
export default function PolaroidPhotoCallout({
  headline = "Run a studio or workshop?\nGet booked through Atlas.",
  lead = "Neighbors browse trusted makers on Atlas and reserve an open slot in seconds. Creating a page costs nothing, and we only charge when a new customer completes their first visit.",
  primaryLabel = "Create your page",
  secondaryLabel = "See how Atlas works",
  primaryHref = "#",
  secondaryHref = "#",
  imageSrc = "https://yoink-app.fly.dev/stock/product-3.jpg",
  imageAlt = "Warm, grainy close-up of a vintage camera on a dark surface",
}: {
  headline?: string;
  lead?: string;
  primaryLabel?: string;
  secondaryLabel?: string;
  primaryHref?: string;
  secondaryHref?: string;
  imageSrc?: string;
  imageAlt?: string;
}) {
  const chevron = (
    <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
      <path d="M4 2l4 4-4 4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
    </svg>
  );
  return (
    <section className="bg-canvas px-6 py-16 md:px-[74px] md:py-28">
      <div className="mx-auto flex max-w-[1290px] flex-col items-start justify-between gap-12 md:flex-row md:items-center">
        <Reveal from="up" className="max-w-[640px]">
          <h2 className="font-display text-h2 whitespace-pre-line text-ink-deep">{headline}</h2>
          <p className="mt-6 font-sans text-lead text-soft">{lead}</p>
          <div className="mt-6 flex flex-wrap gap-2">
            <a
              href={primaryHref}
              className="inline-flex items-center gap-1.5 rounded-lg bg-ink px-4 py-2.5 text-ui text-canvas transition-colors duration-color-transition ease-color-transition hover:bg-ink-deep focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ink"
            >
              {primaryLabel}
              {chevron}
            </a>
            <a
              href={secondaryHref}
              className="inline-flex items-center gap-1.5 rounded-lg bg-canvas px-4 py-2.5 text-ui text-ink-deep shadow-ring-raised transition-colors duration-color-transition ease-color-transition hover:bg-panel focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ink"
            >
              {secondaryLabel}
              {chevron}
            </a>
          </div>
        </Reveal>
        <Reveal from="scale" delay={150} className="md:mr-6">
          <figure className="w-[270px] rotate-[-2deg] bg-paper p-2 pb-8 shadow-soft sm:w-[270px]" style={{ boxShadow: "0 14px 28px -10px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04)" }}>
            <div className="relative aspect-[250/191] w-full overflow-hidden bg-sand">
              <img src={imageSrc} alt={imageAlt} width={250} height={191} loading="lazy" className="h-full w-full object-cover sepia-[0.35] contrast-90" />
              <div className="absolute inset-0 bg-ink-deep/20 mix-blend-multiply" />
              <Grain opacity={0.35} blend="overlay" animated />
            </div>
          </figure>
        </Reveal>
      </div>
    </section>
  );
}

// ---- Yoink motion (inlined, no dependencies): Reveal, Grain ----

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;
}

// Background and overlay layers sit inside their parent: make sure it can hold them.
function ykPrepareParent(el: HTMLElement | null, isolate = false) {
  const p = el?.parentElement;
  if (!p) return;
  const cs = getComputedStyle(p);
  if (cs.position === "static") p.style.position = "relative";
  if (isolate && cs.isolation !== "isolate" && cs.zIndex === "auto") p.style.isolation = "isolate";
}

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>
  );
}

const YK_GRAIN_CSS = `@keyframes yk-grain{0%{transform:translate(0,0)}25%{transform:translate(-3%,2%)}50%{transform:translate(2%,-3%)}75%{transform:translate(-2%,-1%)}100%{transform:translate(1%,3%)}}
@media (prefers-reduced-motion:reduce){[data-yk-grain] *{animation:none!important}}`;
const YK_NOISE = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1.6 -0.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`;

/** A film-grain texture over a section (adds tactile depth to flat colour or gradients). */
function Grain({
  opacity = 0.12,
  blend = "overlay",
  animated = false,
  className,
  style,
}: {
  opacity?: number;
  blend?: CSSProperties["mixBlendMode"];
  animated?: boolean;
  className?: string;
  style?: CSSProperties;
}) {
  const ref = useRef<HTMLDivElement>(null);
  useYkLayoutEffect(() => ykPrepareParent(ref.current), []);
  return (
    <div
      ref={ref}
      aria-hidden="true"
      data-yk-grain=""
      className={className}
      style={{ position: "absolute", inset: 0, overflow: "hidden", pointerEvents: "none", borderRadius: "inherit", opacity, mixBlendMode: blend, ...style }}
    >
      {animated && <style>{YK_GRAIN_CSS}</style>}
      <div style={{ position: "absolute", inset: "-10%", backgroundImage: YK_NOISE, animation: animated ? "yk-grain 0.9s steps(4) infinite" : undefined }} />
    </div>
  );
}

Quality checks

Automated, in a real browser · 4d ago
—

More from Warm Paper Calendar

The whole style →

Floating Pill Navigation Bar

Headers & nav bars

Hub-and-Spoke Integration Diagram

Animated graphics

Customer Story Accordion

Accordions

Inline-Chip Headline Hero

Heroes

Frosted Desktop Booking Mockup

Media & mockups

Monochrome Logo Grid

Logo clouds