({
command,
copyCommand,
}: CopyCommandButtonProps)
| 11 | } |
| 12 | |
| 13 | export default function CopyCommandButton({ |
| 14 | command, |
| 15 | copyCommand, |
| 16 | }: CopyCommandButtonProps) { |
| 17 | const copy = () => { |
| 18 | navigator.clipboard.writeText(copyCommand); |
| 19 | toast("Command copied to clipboard"); |
| 20 | }; |
| 21 | |
| 22 | const shortCommand = command.split(" ").at(-1); |
| 23 | |
| 24 | return ( |
| 25 | <Button |
| 26 | className="font-mono text-xs md:text-sm" |
| 27 | onClick={copy} |
| 28 | variant="outline" |
| 29 | > |
| 30 | <Terminal className="size-3 md:size-4" /> |
| 31 | <span className="hidden sm:block">{command}</span> |
| 32 | <span className="block sm:hidden"> |
| 33 | <span className="font-mono">{shortCommand}</span> |
| 34 | </span> |
| 35 | </Button> |
| 36 | ); |
| 37 | } |
nothing calls this directly
no outgoing calls
no test coverage detected