Skip to content

Your library

Playlists

Morning

Playlist · 24 songs

Black overlayrgb(0 0 0 / 0.4)
Light gradient + blur2→16px, 4 steps

Study

What goes behind a sheet

Paper gradient (0.92 → 0.15) over 4 backdrop-blur steps, 2→16px, instead of rgb(0 0 0 / 0.4); 300ms opacity fade.

A black overlay dims everything behind a sheet by the same amount, so the screen goes muddy and the sheet sits on a hole. A light gradient keeps the page’s own colour, and a blur that ramps from 2px at the top to 16px at the sheet pushes the content back without hiding where you were.

The blur is four stacked backdrop-filter layers, each stronger one masked to a shorter band from the bottom. Each layer fades its own opacity over 300ms: fading a shared parent would cut the blur off from what’s behind it.

Original
The first version
"use client"

import { useCallback, useEffect, useState } from "react"
import { PhoneScreen } from "./phone-screen"

const SHEET_ID = "sheet-backdrop-pair"

/** The same screen twice, driven by one state: black overlay on the left, light + blur on the right. */
export function BackdropCompare() {
  const [open, setOpen] = useState(false)
  const [active, setActive] = useState(0)

  const show = useCallback((index: number) => {
    setActive(index)
    setOpen(true)
  }, [])
  const hide = useCallback(() => setOpen(false), [])

  useEffect(() => {
    if (!open) return
    const onKey = (event: KeyboardEvent) => {
      if (event.key === "Escape") setOpen(false)
    }
    window.addEventListener("keydown", onKey)
    return () => window.removeEventListener("keydown", onKey)
  }, [open])

  return (
    <div className="flex w-full flex-col items-center gap-8">
      <div id={SHEET_ID} className="flex items-start justify-center gap-3 sm:gap-10">
        <figure className="flex flex-col items-center gap-3">
          <PhoneScreen backdrop="black" open={open} active={active} onOpen={show} onClose={hide} />
          <figcaption className="text-center font-mono text-xs text-[#63635f]">
            Black overlay
            <span className="block text-[#8b8b86]">rgb(0 0 0 / 0.4)</span>
          </figcaption>
        </figure>
        <figure className="flex flex-col items-center gap-3">
          <PhoneScreen backdrop="light" open={open} active={active} onOpen={show} onClose={hide} mirror />
          <figcaption className="text-center font-mono text-xs text-[#63635f]">
            Light gradient + blur
            <span className="block text-[#8b8b86]">2→16px, 4 steps</span>
          </figcaption>
        </figure>
      </div>

      <button
        type="button"
        aria-expanded={open}
        aria-controls={SHEET_ID}
        onClick={() => setOpen((value) => !value)}
        className="h-11 min-w-36 rounded-full bg-[#1f1f1e] px-5 text-sm font-medium text-white transition-[scale] duration-150 ease-out [touch-action:manipulation] active:scale-[0.97] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#3f6f7a] motion-reduce:active:scale-100"
      >
        {open ? "Close sheet" : "Open sheet"}
      </button>
    </div>
  )
}
All entries