{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "video-card", "title": "Video Card", "description": "A YouTube card that stays cheap until it is wanted. The player iframe only mounts on click, or pass href and the card navigates out instead of embedding.", "dependencies": [ "lucide-react" ], "registryDependencies": [ "@duck/theme" ], "files": [ { "path": "registry/duck/ui/video-card.tsx", "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { ArrowUpRight, Play } from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\n\n/**\n * VideoCard — a YouTube card that stays cheap until it is wanted. The\n * thumbnail is a plain image; the player iframe only mounts on click, so a\n * page full of these costs nothing on load.\n *\n * Pass `href` instead and the card navigates rather than embedding. That is\n * not a lesser mode: a channel gallery wants the outbound click tracked and\n * the subscription credited, and a page under a strict consent banner cannot\n * mount a third-party player at all.\n */\nfunction VideoCard({\n className,\n videoId,\n title,\n channel,\n duration,\n thumbnail,\n href,\n target,\n rel,\n onClick,\n holo = false,\n ...props\n}: Omit, \"title\"> & {\n /** YouTube video id, the part after v=. */\n videoId: string;\n title: string;\n channel?: string;\n /** Runtime label, for example \"12:04\". */\n duration?: string;\n /** Override the default YouTube thumbnail. */\n thumbnail?: string;\n /**\n * Navigate here instead of mounting the player. Pass the watch URL, or your\n * own redirect if the click is being tracked.\n */\n href?: string;\n target?: React.ComponentProps<\"a\">[\"target\"];\n rel?: string;\n /** Fires on the play button, or on the link when href is set. */\n onClick?: React.MouseEventHandler;\n holo?: boolean;\n}) {\n const [playing, setPlaying] = React.useState(false);\n const poster =\n thumbnail ?? `https://i.ytimg.com/vi/${videoId}/maxresdefault.jpg`;\n const links = Boolean(href);\n\n const art = (\n <>\n \n \n \n \n {links ? (\n \n ) : (\n \n )}\n \n \n {duration && (\n \n {duration}\n \n )}\n \n );\n\n return (\n \n
\n {links ? (\n \n {art}\n \n ) : playing ? (\n \n ) : (\n {\n onClick?.(event);\n if (!event.defaultPrevented) setPlaying(true);\n }}\n aria-label={`Play ${title}`}\n className=\"absolute inset-0 size-full cursor-pointer\"\n >\n {art}\n \n )}\n
\n\n
\n

\n {title}\n

\n {channel &&

{channel}

}\n
\n \n );\n}\n\nexport { VideoCard };\n", "type": "registry:ui" } ], "type": "registry:ui" }