{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "v-popover-10",
  "description": "Share Link",
  "registryDependencies": [
    "@cnippet/popover"
  ],
  "files": [
    {
      "path": "registry/default/variants/v-popover-10.tsx",
      "content": "// title: Share Link\n\"use client\";\n\nimport {\n  CheckIcon,\n  CopyIcon,\n  GlobeIcon,\n  LinkIcon,\n  MailIcon,\n  MessageSquareIcon,\n  Share2Icon,\n} 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 PAGE_URL = \"https://cnippet.ui/components/popover\";\n\nconst shareChannels = [\n  { badge: undefined, icon: MailIcon, label: \"Email\" },\n  { badge: undefined, icon: MessageSquareIcon, label: \"Direct Message\" },\n  { badge: \"Pro\", icon: GlobeIcon, label: \"Publish to Web\" },\n] as const;\n\nexport function Pattern() {\n  const [copied, setCopied] = useState(false);\n\n  const handleCopy = () => {\n    navigator.clipboard.writeText(PAGE_URL).catch(() => null);\n    setCopied(true);\n    setTimeout(() => setCopied(false), 2000);\n  };\n\n  return (\n    <div className=\"flex min-h-25 items-center justify-center\">\n      <Popover>\n        <PopoverTrigger render={<Button variant=\"outline\" />}>\n          <Share2Icon aria-hidden=\"true\" />\n          Share\n        </PopoverTrigger>\n        <PopoverContent align=\"center\" className=\"w-72 gap-0 p-0\" side=\"bottom\">\n          <div className=\"border-b px-0 py-3\">\n            <h4 className=\"font-semibold\">Share this page</h4>\n            <p className=\"mt-0.5 text-muted-foreground text-xs\">\n              Anyone with the link can view.\n            </p>\n          </div>\n\n          <div className=\"space-y-3 px-0 py-3\">\n            <div className=\"flex items-center gap-2 rounded-lg border bg-muted/50 px-3 py-2\">\n              <LinkIcon\n                aria-hidden=\"true\"\n                className=\"size-3.5 shrink-0 text-muted-foreground\"\n              />\n              <span className=\"min-w-0 flex-1 truncate text-muted-foreground text-sm\">\n                {PAGE_URL}\n              </span>\n              <Button\n                aria-label={copied ? \"Copied!\" : \"Copy link\"}\n                className=\"size-6 shrink-0\"\n                onClick={handleCopy}\n                size=\"icon\"\n                variant=\"ghost\"\n              >\n                {copied ? (\n                  <CheckIcon\n                    aria-hidden=\"true\"\n                    className=\"size-3.5 text-success-foreground\"\n                  />\n                ) : (\n                  <CopyIcon aria-hidden=\"true\" className=\"size-3.5\" />\n                )}\n              </Button>\n            </div>\n\n            <div>\n              <p className=\"mb-2 font-medium text-muted-foreground text-xs uppercase tracking-wide\">\n                Share via\n              </p>\n              <div className=\"space-y-0.5\">\n                {shareChannels.map(({ label, icon: Icon, badge }) => (\n                  <button\n                    className=\"flex w-full items-center gap-3 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-muted\"\n                    key={label}\n                  >\n                    <span className=\"flex size-6 shrink-0 items-center justify-center rounded border bg-background\">\n                      <Icon aria-hidden=\"true\" className=\"size-3.5\" />\n                    </span>\n                    <span className=\"flex-1 text-left\">{label}</span>\n                    {badge && (\n                      <Badge className=\"h-4 px-1 text-[10px]\" variant=\"outline\">\n                        {badge}\n                      </Badge>\n                    )}\n                  </button>\n                ))}\n              </div>\n            </div>\n          </div>\n\n          <div className=\"border-t px-0 py-2.5\">\n            <p className=\"text-muted-foreground text-xs\">\n              Link expires in{\" \"}\n              <span className=\"font-medium text-foreground\">7 days</span>.\n            </p>\n          </div>\n        </PopoverContent>\n      </Popover>\n    </div>\n  );\n}\n",
      "type": "registry:block"
    }
  ],
  "meta": {
    "className": ""
  },
  "categories": [
    "popover"
  ],
  "type": "registry:block"
}