CopiableUrl.tsx (718B)
1 import React from 'react'; 2 import { Copy } from 'lucide-react'; 3 import { cn } from '@/lib/utils'; 4 5 const CopiableUrl = ({ url, className }: { url: string; className?: string }) => { 6 return ( 7 <div className={cn("flex items-center justify-between rounded-md bg-purple-200/20", className)}> 8 <div className="w-full text-sm text-purple-200/50 font-normal px-4 py-2 overflow-x-scroll"> 9 {url} 10 </div> 11 <button 12 className="text-sm text-purple-200/50 font-normal px-4 py-2 active:text-purple-200/30 hover:text-purple-200/80 transition" 13 onClick={() => navigator.clipboard.writeText(url || "")} 14 > 15 <Copy /> 16 </button> 17 </div> 18 ); 19 }; 20 21 export default CopiableUrl;