Page sections / Stats & metrics

Uptime Stat Tile

Large white '99.99%' numeral with a dimmer reflected 'uptime' echo over a curved metallic-grey arc gradient, cropped to a bento cell.

Rebuilt from framer.com in the Obsidian Canvas style.

npx shadcn@latest add https://justyoink.it/r/obsidian-canvas-cc37fa/blocks/stat-chip-uptime.json

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

Usage

Props: value (big numeral), echo (reflected word), label (link text) and href. Fits a bento cell; the arc drifts subtly via Parallax.

components/stat-chip-uptime.tsx
"use client";

import { useEffect, useRef, type CSSProperties, type ReactNode } from "react";
export default function UptimeStatTile({
  value = "99.99%",
  echo = "uptime",
  label = "Hosting",
  href = "#",
}: {
  value?: string;
  echo?: string;
  label?: string;
  href?: string;
}) {
  return (
    <div className="relative isolate h-[240px] w-full max-w-[400px] overflow-hidden bg-canvas border border-hairline text-primary">
      <Parallax speed={0.08} className="absolute inset-x-0 bottom-0 -z-10 h-full">
        <div className="absolute -left-[20%] top-[58%] h-[260px] w-[140%] rounded-[50%] border-t border-white/20 bg-[radial-gradient(70%_100%_at_50%_0%,rgba(255,255,255,0.22),rgba(255,255,255,0.05)_45%,transparent_75%)]" />
        <div className="absolute -right-10 -top-20 h-48 w-48 rounded-full bg-white/10 blur-3xl" />
      </Parallax>
      <div className="pointer-events-none absolute inset-0 -z-10 bg-gradient-to-b from-transparent via-transparent to-canvas/70" />
      <div className="flex flex-col items-center pt-12 text-center">
        <div className="font-display text-[56px] font-medium leading-none tracking-[-0.04em] text-primary">
          {value}
        </div>
        <div
          aria-hidden="true"
          className="font-display text-[56px] font-medium leading-none tracking-[-0.04em] text-transparent bg-clip-text bg-gradient-to-b from-white/50 to-transparent -mt-1"
        >
          {echo}
        </div>
        <span className="sr-only">{echo}</span>
      </div>
      <a
        href={href}
        className="absolute bottom-5 left-6 inline-flex items-center gap-2 text-lead text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent-blue rounded-sm"
      >
        {label}
        <svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" strokeWidth="1.4" aria-hidden="true">
          <path d="M2 7h10M8 3l4 4-4 4" />
        </svg>
      </a>
    </div>
  );
}

// ---- Yoink motion (inlined, no dependencies): Parallax ----

function ykReducedMotion(): boolean {
  return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
}

/** Moves its content a little slower (or faster) than the page as you scroll. */
function Parallax({
  children,
  speed = 0.15,
  className,
  style,
}: {
  children?: ReactNode;
  /** 0 = scrolls normally; 0.2 = lags behind by 20%; negative values move ahead */
  speed?: number;
  className?: string;
  style?: CSSProperties;
}) {
  const ref = useRef<HTMLDivElement>(null);
  const inner = useRef<HTMLDivElement>(null);
  useEffect(() => {
    const box = ref.current, el = inner.current;
    if (!box || !el || ykReducedMotion()) return;
    let raf = 0, visible = true;
    const update = () => {
      raf = 0;
      const r = box.getBoundingClientRect();
      const offset = r.top + r.height / 2 - window.innerHeight / 2;
      el.style.transform = `translate3d(0, ${(-offset * speed).toFixed(1)}px, 0)`;
    };
    const onScroll = () => {
      if (visible && !raf) raf = requestAnimationFrame(update);
    };
    const io = typeof IntersectionObserver !== "undefined" ? new IntersectionObserver(([e]) => (visible = e.isIntersecting)) : null;
    io?.observe(box);
    // re-measure when the page's layout settles (fonts, images, late CSS)
    const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(() => (raf ||= requestAnimationFrame(update))) : null;
    ro?.observe(document.documentElement);
    update();
    window.addEventListener("scroll", onScroll, { passive: true });
    window.addEventListener("resize", onScroll);
    return () => {
      cancelAnimationFrame(raf);
      io?.disconnect();
      ro?.disconnect();
      window.removeEventListener("scroll", onScroll);
      window.removeEventListener("resize", onScroll);
    };
  }, [speed]);
  return (
    <div ref={ref} className={className} style={style}>
      <div ref={inner} style={{ willChange: "transform" }}>
        {children}
      </div>
    </div>
  );
}

Quality checks

Automated, in a real browser · 4d ago
—

More from Obsidian Canvas

The whole style →

Minimal Black Header

Headers & nav bars

Platform Bento Grid

Feature sections

Audience Icon Grid

Feature sections

Sticky-date Changelog Entry

Changelog

Neon Agent Prompt Hero

Heroes

Hairline Triple Feature Strip

Feature sections