feat: add copy button api key

This commit is contained in:
BennyKok
2024-01-18 16:38:02 +08:00
parent 4a474a9fa8
commit b094fcf4b4
2 changed files with 16 additions and 5 deletions
+3
View File
@@ -3,6 +3,7 @@
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { Copy } from "lucide-react";
import { toast } from "sonner";
export function CopyButton({
className,
@@ -13,7 +14,9 @@ export function CopyButton({
}) {
return (
<Button
type="button"
onClick={() => {
toast.success("Copied to clipboard");
navigator.clipboard.writeText(props.text);
}}
className={cn(" p-2 min-h-0 aspect-square", className)}