{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "v-popover-19",
  "description": "Notification panel",
  "registryDependencies": [
    "@cnippet/popover"
  ],
  "files": [
    {
      "path": "registry/default/variants/v-popover-19.tsx",
      "content": "// title: Notification panel\n\"use client\";\n\nimport { BellIcon } from \"lucide-react\";\nimport { useState } from \"react\";\nimport { Badge } from \"@/registry/default/ui/badge\";\nimport { Button } from \"@/registry/default/ui/button\";\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from \"@/registry/default/ui/popover\";\n\nconst initialNotifications = [\n  {\n    id: 1,\n    read: false,\n    text: \"Jamie left a comment on your post.\",\n    time: \"2m ago\",\n  },\n  {\n    id: 2,\n    read: false,\n    text: \"Your export is ready to download.\",\n    time: \"15m ago\",\n  },\n  {\n    id: 3,\n    read: true,\n    text: \"Alex invited you to join the workspace.\",\n    time: \"1h ago\",\n  },\n];\n\nexport function Pattern() {\n  const [items, setItems] = useState(initialNotifications);\n  const unread = items.filter((n) => !n.read).length;\n\n  return (\n    <div className=\"flex min-h-25 items-center justify-center\">\n      <Popover>\n        <PopoverTrigger\n          aria-label=\"Notifications\"\n          render={<Button size=\"icon\" variant=\"outline\" />}\n        >\n          <span className=\"relative\">\n            <BellIcon aria-hidden=\"true\" className=\"size-4\" />\n            {unread > 0 && (\n              <span className=\"absolute -top-1 -right-1 flex size-3.5 items-center justify-center rounded-full bg-destructive font-bold text-[9px] text-destructive-foreground\">\n                {unread}\n              </span>\n            )}\n          </span>\n        </PopoverTrigger>\n        <PopoverContent align=\"end\" className=\"w-72 gap-0 p-0\">\n          <div className=\"flex items-center justify-between border-b px-3 py-2.5\">\n            <div className=\"flex items-center gap-2\">\n              <h4 className=\"font-semibold text-sm\">Notifications</h4>\n              {unread > 0 && <Badge size=\"sm\">{unread}</Badge>}\n            </div>\n            <button\n              className=\"text-muted-foreground text-xs hover:text-foreground\"\n              onClick={() =>\n                setItems((p) => p.map((n) => ({ ...n, read: true })))\n              }\n              type=\"button\"\n            >\n              Mark all read\n            </button>\n          </div>\n          <div className=\"divide-y\">\n            {items.map((n) => (\n              <button\n                className={`flex w-full gap-3 px-3 py-2.5 text-left transition-colors hover:bg-muted ${n.read ? \"opacity-60\" : \"\"}`}\n                key={n.id}\n                onClick={() =>\n                  setItems((p) =>\n                    p.map((item) =>\n                      item.id === n.id ? { ...item, read: true } : item,\n                    ),\n                  )\n                }\n                type=\"button\"\n              >\n                <span\n                  className={`mt-1.5 size-1.5 shrink-0 rounded-full ${n.read ? \"bg-transparent\" : \"bg-primary\"}`}\n                />\n                <div className=\"min-w-0 flex-1\">\n                  <p className=\"text-sm\">{n.text}</p>\n                  <p className=\"text-muted-foreground text-xs\">{n.time}</p>\n                </div>\n              </button>\n            ))}\n          </div>\n        </PopoverContent>\n      </Popover>\n    </div>\n  );\n}\n",
      "type": "registry:block"
    }
  ],
  "meta": {
    "className": ""
  },
  "categories": [
    "popover"
  ],
  "type": "registry:block"
}