Openstatus www.openstatus.dev
at e04c855d4ded3de361d0d758827dbfc50ff511d0 25 lines 607 B view raw
1"use client"; 2 3import { useCopyToClipboard } from "@/hooks/use-copy-to-clipboard"; 4import { cn } from "@/lib/utils"; 5import { Button } from "@openstatus/ui"; 6 7export function CopyButton({ 8 className, 9 copyText, 10 ...props 11}: React.ComponentProps<typeof Button> & { copyText: string }) { 12 const { copy, isCopied } = useCopyToClipboard(); 13 14 return ( 15 <Button 16 variant="ghost" 17 size="lg" 18 className={cn("rounded-none p-4", className)} 19 onClick={() => copy(copyText, { withToast: true })} 20 {...props} 21 > 22 {isCopied ? "[link copied]" : "[copy link]"} 23 </Button> 24 ); 25}