remove copy copy button from code dropdown (#3317)

This commit is contained in:
Jonathan Dobson
2025-08-29 11:06:38 -04:00
committed by GitHub
parent f8685832ff
commit 410343276d
2 changed files with 25 additions and 21 deletions

View File

@@ -0,0 +1,25 @@
import { useState } from "react";
import { CheckIcon, CopyIcon } from "@radix-ui/react-icons";
import { Button } from "@/components/ui/button";
function CopyButton({ value }: { value: string }) {
const [copied, setCopied] = useState(false);
const handleCopy = () => {
if (copied) {
return;
}
window.navigator.clipboard.writeText(value);
setCopied(true);
setTimeout(() => setCopied(false), 1500);
};
return (
<Button size="icon" variant="ghost" onClick={handleCopy}>
{copied ? <CheckIcon /> : <CopyIcon />}
</Button>
);
}
export { CopyButton };