"use client" import * as React from "react" import Link from "next/link" import { IconCheck } from "@tabler/icons-react" import { cn } from "@/lib/utils" import { useCopyToClipboard } from "@/hooks/use-copy-to-clipboard" import { useIsMobile } from "@/hooks/use-mobile" import { CopyButton } from "@/components/copy-button" import { Button } from "@/registry/new-york-v4/ui/button" import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/registry/new-york-v4/ui/dialog" import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, } from "@/registry/new-york-v4/ui/drawer" export function DirectoryAddButton({ registry, }: { registry: { name: string url: string } }) { const { copyToClipboard, isCopied } = useCopyToClipboard() const isMobile = useIsMobile() const [open, setOpen] = React.useState(false) const jsonValue = `{ "registries": { "${registry.name}": "${registry.url}" } }` const Trigger = ( setOpen(true)} > {isCopied ? ( ) : ( Model Context Protocol )} MCP ) const Content = ( <> components.json {"{"} {' "registries": {'} {` "${registry.name}": "${registry.url}"`} {" }"} {"}"} > ) if (isMobile) { return ( {Trigger} Configure MCP Copy and paste the following code into your project's components.json. {Content} Close Read the docs ) } return ( {Trigger} e.preventDefault()} > Configure MCP Copy and paste the following code into your project's components.json. {Content} Read the docs Done ) }
{"{"} {' "registries": {'} {` "${registry.name}": "${registry.url}"`} {" }"} {"}"}