{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "mesh-gradient-announcement-bar",
  "title": "Mesh Gradient Announcement Bar",
  "description": "A thin, dismissible announcement strip over a slowly flowing mesh gradient.",
  "dependencies": [
    "@paper-design/shaders-react",
    "lucide-react"
  ],
  "files": [
    {
      "path": "registry/shaders/mesh-gradient-announcement-bar/mesh-gradient-announcement-bar.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { MeshGradient } from \"@paper-design/shaders-react\"\nimport { ArrowRightIcon, XIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype MeshGradientAnnouncementBarProps = React.ComponentProps<\"div\"> & {\n  /** A short tag before the message, like \"New\". */\n  badge?: string\n  message?: string\n  /** The whole bar links here. */\n  action?: { label: string; href: string }\n  /** Show a close button. The bar hides itself when it's clicked. */\n  dismissible?: boolean\n  /** Called when the bar is closed. Use it to remember the choice, e.g. in a cookie. */\n  onDismiss?: () => void\n  /** Keep them dark enough for white text. */\n  colors?: string[]\n  speed?: number\n}\n\nfunction MeshGradientAnnouncementBar({\n  badge = \"News\",\n  message = \"We raised our $24M Series A\",\n  action = { label: \"Read the announcement\", href: \"#\" },\n  dismissible = true,\n  onDismiss,\n  colors = [\"#1e1b4b\", \"#4338ca\", \"#7e22ce\", \"#be185d\"],\n  speed = 0.4,\n  className,\n  style,\n  ...props\n}: MeshGradientAnnouncementBarProps) {\n  const [dismissed, setDismissed] = React.useState(false)\n  const [reducedMotion, setReducedMotion] = React.useState(false)\n\n  React.useEffect(() => {\n    const query = window.matchMedia(\"(prefers-reduced-motion: reduce)\")\n    const update = () => setReducedMotion(query.matches)\n    update()\n    query.addEventListener(\"change\", update)\n    return () => query.removeEventListener(\"change\", update)\n  }, [])\n\n  if (dismissed) return null\n\n  return (\n    <div\n      data-slot=\"mesh-gradient-announcement-bar\"\n      className={cn(\n        \"dark relative isolate flex min-h-10 w-full items-center justify-center overflow-hidden px-12 py-2 text-sm text-white\",\n        className\n      )}\n      style={{ backgroundColor: colors[0], ...style }}\n      {...props}\n    >\n      <MeshGradient\n        aria-hidden\n        className=\"absolute inset-0 -z-10 size-full\"\n        colors={colors}\n        distortion={0.8}\n        swirl={0.2}\n        grainOverlay={0.15}\n        speed={reducedMotion ? 0 : speed}\n        // Stretch the pattern along the bar, so the colors flow from side to\n        // side instead of a few blobs squeezed into a thin strip.\n        fit=\"none\"\n        worldWidth={1600}\n        worldHeight={200}\n      />\n      <p className=\"flex min-w-0 items-center gap-3\">\n        {badge && (\n          <span className=\"shrink-0 rounded-full bg-white/15 px-2 py-0.5 font-mono text-[10px] tracking-widest uppercase ring-1 ring-white/25 ring-inset\">\n            {badge}\n          </span>\n        )}\n        <span className=\"truncate font-medium\">{message}</span>\n        <a\n          href={action.href}\n          className=\"group/action inline-flex shrink-0 items-center gap-1 text-white/75 outline-none after:absolute after:inset-0 hover:text-white focus-visible:text-white focus-visible:after:ring-2 focus-visible:after:ring-white/60 focus-visible:after:ring-inset\"\n        >\n          <span className=\"max-sm:sr-only\">{action.label}</span>\n          <ArrowRightIcon className=\"size-3.5 transition-transform group-hover/action:translate-x-0.5\" />\n        </a>\n      </p>\n      {dismissible && (\n        <button\n          type=\"button\"\n          aria-label=\"Dismiss announcement\"\n          className=\"absolute top-1/2 right-3 z-10 flex size-7 -translate-y-1/2 items-center justify-center rounded-full text-white/70 outline-none hover:bg-white/15 hover:text-white focus-visible:ring-2 focus-visible:ring-white/60\"\n          onClick={() => {\n            setDismissed(true)\n            onDismiss?.()\n          }}\n        >\n          <XIcon className=\"size-4\" />\n        </button>\n      )}\n    </div>\n  )\n}\n\nexport { MeshGradientAnnouncementBar }\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "sections",
    "banner"
  ],
  "type": "registry:block"
}