MCPcopy Create free account
hub / github.com/TheOrcDev/8bitcn-ui / CopyCommandButton

Function CopyCommandButton

components/copy-command-button.tsx:13–37  ·  view source on GitHub ↗
({
  command,
  copyCommand,
}: CopyCommandButtonProps)

Source from the content-addressed store, hash-verified

11}
12
13export 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected