{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "media-08",
  "type": "registry:block",
  "description": "Music player card with album art, transport controls and a clickable tracklist.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "registry/designali/blocks/media/media-08.tsx",
      "content": "\"use client\"\n\nimport { useEffect, useState } from \"react\"\nimport {\n  Heart,\n  ListMusic,\n  Pause,\n  Play,\n  Repeat,\n  Shuffle,\n  SkipBack,\n  SkipForward,\n} from \"@designali/icons\"\n\nimport { cn } from \"@workspace/ui/lib/utils\"\n\nconst tracks = [\n  { title: \"Design se Code Tak\", length: 214 },\n  { title: \"Pixel Rain\", length: 187 },\n  { title: \"Grid Lines\", length: 263 },\n  { title: \"Dark Mode (Interlude)\", length: 92 },\n  { title: \"Tailwind Drift\", length: 231 },\n  { title: \"Ship It\", length: 298 },\n]\nconst fmt = (s: number) =>\n  `${Math.floor(s / 60)}:${String(s % 60).padStart(2, \"0\")}`\n\nexport default function Media08() {\n  const [current, setCurrent] = useState(0)\n  const [playing, setPlaying] = useState(false)\n  const [time, setTime] = useState(0)\n  const [shuffle, setShuffle] = useState(false)\n  const [repeat, setRepeat] = useState(false)\n  const [liked, setLiked] = useState<number[]>([2])\n  const track = tracks[current]!\n\n  useEffect(() => {\n    if (!playing) return\n    const id = setTimeout(() => {\n      if (time + 1 < track.length) return setTime(time + 1)\n      if (!repeat) setCurrent((c) => (c + 1) % tracks.length)\n      setTime(0)\n    }, 1000)\n    return () => clearTimeout(id)\n  }, [playing, time, repeat, track.length])\n\n  const go = (dir: number) => {\n    setCurrent((c) => (c + dir + tracks.length) % tracks.length)\n    setTime(0)\n  }\n\n  return (\n    <section className=\"w-full bg-background py-20\">\n      <div className=\"mx-auto grid max-w-5xl overflow-hidden border border-border md:grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)]\">\n        <div className=\"flex flex-col bg-muted/40 p-6 md:p-8\">\n          <div\n            className={cn(\n              \"relative aspect-square w-full overflow-hidden border border-border transition-transform duration-500\",\n              playing && \"scale-[1.02]\"\n            )}\n          >\n            <img\n              src=\"/img/ask/ask7.jpg\"\n              alt=\"Designali Sessions cover art\"\n              className=\"absolute inset-0 size-full object-cover\"\n            />\n            <span className=\"absolute bottom-4 left-4 bg-background/85 px-2 py-1 text-[11px] font-medium tracking-widest uppercase backdrop-blur\">\n              Designali - Sessions\n            </span>\n          </div>\n          <div className=\"mt-6 flex items-start justify-between gap-4\">\n            <div className=\"min-w-0\">\n              <p className=\"truncate text-lg font-semibold\">{track.title}</p>\n              <p className=\"text-sm text-muted-foreground\">Designali Studio</p>\n            </div>\n            <button\n              type=\"button\"\n              aria-label=\"Like\"\n              aria-pressed={liked.includes(current)}\n              onClick={() =>\n                setLiked((l) =>\n                  l.includes(current)\n                    ? l.filter((x) => x !== current)\n                    : [...l, current]\n                )\n              }\n              className=\"p-1\"\n            >\n              <Heart\n                className={cn(\n                  \"size-5\",\n                  liked.includes(current)\n                    ? \"fill-primary text-primary\"\n                    : \"text-muted-foreground\"\n                )}\n              />\n            </button>\n          </div>\n          <div className=\"mt-4\">\n            <input\n              type=\"range\"\n              min={0}\n              max={track.length}\n              value={time}\n              onChange={(e) => setTime(Number(e.target.value))}\n              aria-label=\"Seek\"\n              className=\"h-1 w-full cursor-pointer accent-foreground\"\n            />\n            <div className=\"mt-1 flex justify-between font-sans text-xs text-muted-foreground tabular-nums\">\n              <span>{fmt(time)}</span>\n              <span>-{fmt(track.length - time)}</span>\n            </div>\n          </div>\n          <div className=\"mt-4 flex items-center justify-between\">\n            <button\n              type=\"button\"\n              aria-label=\"Shuffle\"\n              aria-pressed={shuffle}\n              onClick={() => setShuffle((s) => !s)}\n              className={cn(\n                \"p-2\",\n                shuffle ? \"text-foreground\" : \"text-muted-foreground\"\n              )}\n            >\n              <Shuffle className=\"size-4\" />\n            </button>\n            <button\n              type=\"button\"\n              aria-label=\"Previous\"\n              onClick={() => go(-1)}\n              className=\"p-2\"\n            >\n              <SkipBack className=\"size-5 fill-current\" />\n            </button>\n            <button\n              type=\"button\"\n              aria-label={playing ? \"Pause\" : \"Play\"}\n              onClick={() => setPlaying((p) => !p)}\n              className=\"flex size-14 items-center justify-center rounded-full bg-foreground text-background transition-transform active:scale-95\"\n            >\n              {playing ? (\n                <Pause className=\"size-6 fill-current\" />\n              ) : (\n                <Play className=\"size-6 translate-x-0.5 fill-current\" />\n              )}\n            </button>\n            <button\n              type=\"button\"\n              aria-label=\"Next\"\n              onClick={() => go(1)}\n              className=\"p-2\"\n            >\n              <SkipForward className=\"size-5 fill-current\" />\n            </button>\n            <button\n              type=\"button\"\n              aria-label=\"Repeat\"\n              aria-pressed={repeat}\n              onClick={() => setRepeat((r) => !r)}\n              className={cn(\n                \"p-2\",\n                repeat ? \"text-foreground\" : \"text-muted-foreground\"\n              )}\n            >\n              <Repeat className=\"size-4\" />\n            </button>\n          </div>\n        </div>\n        <div className=\"flex flex-col p-6 md:p-8\">\n          <div className=\"flex items-center justify-between\">\n            <h2 className=\"flex items-center gap-2 font-semibold\">\n              <ListMusic className=\"size-4\" /> Tracklist\n            </h2>\n            <span className=\"text-xs text-muted-foreground\">\n              6 songs - 21 min\n            </span>\n          </div>\n          <ol className=\"mt-4 divide-y divide-border\">\n            {tracks.map((t, i) => (\n              <li key={t.title}>\n                <button\n                  type=\"button\"\n                  onClick={() => {\n                    setCurrent(i)\n                    setTime(0)\n                    setPlaying(true)\n                  }}\n                  className={cn(\n                    \"grid w-full grid-cols-[1.5rem_1fr_auto] items-center gap-3 py-3 text-left text-sm hover:bg-muted/50\",\n                    i === current && \"font-medium\"\n                  )}\n                >\n                  {i === current && playing ? (\n                    <span className=\"flex h-3 items-end gap-0.5\" aria-hidden>\n                      {[0, 1, 2].map((b) => (\n                        <span\n                          key={b}\n                          className=\"w-0.5 animate-pulse bg-foreground\"\n                          style={{\n                            height: `${[60, 100, 40][b]}%`,\n                            animationDelay: `${b * 150}ms`,\n                          }}\n                        />\n                      ))}\n                    </span>\n                  ) : (\n                    <span className=\"font-sans text-xs text-muted-foreground\">\n                      {i + 1}\n                    </span>\n                  )}\n                  <span className=\"truncate\">{t.title}</span>\n                  <span className=\"font-sans text-xs text-muted-foreground tabular-nums\">\n                    {fmt(t.length)}\n                  </span>\n                </button>\n              </li>\n            ))}\n          </ol>\n          <p className=\"mt-auto pt-6 text-xs text-muted-foreground\">\n            A Designali playlist for deep design and code work\n          </p>\n        </div>\n      </div>\n    </section>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "iframeHeight": "800px"
  },
  "categories": [
    "media"
  ]
}