Cards & content / Media & mockups

Rounded Showreel Video Frame

Full-width black video block with small radius, a centred circular grey play button ringed by rotating uppercase text, and minimal player controls at the corners; preceded by a tiny tracked label and hairline rules.

Rebuilt from epic.net in the Gallery Graphite Editorial style.

npx shadcn@latest add https://yoink-app.fly.dev/r/gallery-graphite-editorial/blocks/showreel-player.json

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

Usage

Props: label (small tracked heading), badgeText (text circling the play button), posterSrc (optional poster image) and videoSrc (optional video played on click). Renders standalone with a black frame and working play/mute controls.

components/showreel-player.tsx
"use client";

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

type Props = {
  label?: string;
  badgeText?: string;
  posterSrc?: string;
  videoSrc?: string;
};

export default function RoundedShowreelVideoFrame({
  label = "Highlights reel",
  badgeText = "Studio cut 2024 \u2022 Press play \u2022 ",
  posterSrc,
  videoSrc,
}: Props) {
  const [playing, setPlaying] = useState(false);
  const [muted, setMuted] = useState(true);

  return (
    <section className="bg-canvas text-ink font-sans px-5 md:px-12 py-10 md:py-16">
      <div className="mx-auto max-w-6xl">
        <hr className="border-0 h-px bg-hairline" />
        <Reveal from="none" duration={900}>
          <p className="text-label uppercase text-center text-[10px] tracking-[0.35em] py-10 md:py-14">{label}</p>
        </Reveal>
        <Reveal from="up" duration={900}>
          <div className="relative aspect-video w-full overflow-hidden rounded-small bg-black">
            {videoSrc && playing ? (
              <video src={videoSrc} poster={posterSrc} autoPlay muted={muted} loop playsInline className="absolute inset-0 h-full w-full object-cover" />
            ) : posterSrc ? (
              <img src={posterSrc} alt="" width={1600} height={900} className="absolute inset-0 h-full w-full object-cover opacity-70" />
            ) : null}

            {!playing && (
              <button
                type="button"
                onClick={() => setPlaying(true)}
                aria-label="Play video"
                className="group absolute left-1/2 top-1/2 h-24 w-24 -translate-x-1/2 -translate-y-1/2 rounded-circle bg-canvas text-ink transition-transform duration-smooth-slide ease-smooth-slide hover:scale-110 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-canvas md:h-28 md:w-28"
              >
                <svg viewBox="0 0 100 100" className="absolute inset-0 h-full w-full animate-badge-spin" aria-hidden="true">
                  <defs>
                    <path id="showreel-ring" d="M50,50 m-38,0 a38,38 0 1,1 76,0 a38,38 0 1,1 -76,0" />
                  </defs>
                  <text fontSize="8.5" letterSpacing="2.2" fill="currentColor" style={{ textTransform: "uppercase" }}>
                    <textPath href="#showreel-ring">{badgeText.repeat(1)}</textPath>
                  </text>
                </svg>
                <svg viewBox="0 0 24 24" className="absolute left-1/2 top-1/2 h-5 w-5 -translate-x-1/2 -translate-y-1/2" fill="none" stroke="currentColor" strokeWidth="1.5" aria-hidden="true">
                  <path d="M8 5.5v13l11-6.5z" strokeLinejoin="round" />
                </svg>
              </button>
            )}

            <div className="absolute bottom-3 left-4 md:bottom-4 md:left-5">
              <button type="button" onClick={() => setPlaying(!playing)} aria-label={playing ? "Pause" : "Play"} className="text-on-ink p-1 focus-visible:outline focus-visible:outline-1 focus-visible:outline-on-ink">
                <svg viewBox="0 0 24 24" className="h-4 w-4" fill="currentColor" aria-hidden="true">
                  {playing ? <path d="M7 5h3.5v14H7zM13.5 5H17v14h-3.5z" /> : <path d="M7 4.5v15l13-7.5z" />}
                </svg>
              </button>
            </div>
            <div className="absolute bottom-3 right-4 flex items-center gap-4 md:bottom-4 md:right-5">
              <button type="button" onClick={() => setMuted(!muted)} aria-label={muted ? "Unmute" : "Mute"} className="text-on-ink p-1 focus-visible:outline focus-visible:outline-1 focus-visible:outline-on-ink">
                <svg viewBox="0 0 24 24" className="h-4 w-4" fill="none" stroke="currentColor" strokeWidth="1.6" aria-hidden="true">
                  <path d="M4 9.5v5h4l5 4v-13l-5 4z" fill="currentColor" />
                  {muted ? <path d="M17 9l4 6M21 9l-4 6" /> : <path d="M16.5 8.5a5 5 0 010 7M19 6a8.5 8.5 0 010 12" />}
                </svg>
              </button>
              <button type="button" aria-label="Fullscreen" className="text-on-ink p-1 focus-visible:outline focus-visible:outline-1 focus-visible:outline-on-ink">
                <svg viewBox="0 0 24 24" className="h-4 w-4" fill="none" stroke="currentColor" strokeWidth="1.6" aria-hidden="true">
                  <path d="M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7" />
                </svg>
              </button>
            </div>
          </div>
        </Reveal>
        <hr className="border-0 h-px bg-hairline mt-10 md:mt-14" />
      </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 Gallery Graphite Editorial

The whole style →

Outlined Arrow Pill Button

Buttons

Square Outline Cookie Panel

Toasts & snackbars

Line-Art Blueprint Illustration

Animated graphics

Tracked Micro Label

Badges & tags

Hairline Minimal Header

Headers & nav bars

Floating Object Project Hero

Heroes