From 580e798e16346eb894eb899edac82d2efdf40adc Mon Sep 17 00:00:00 2001
From: Christian Cleberg <hello@cleberg.net>
Date: Sat, 18 Apr 2026 22:32:53 -0500
Subject: initial commit

---
 src/components/CopyButton.tsx | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 src/components/CopyButton.tsx

(limited to 'src/components/CopyButton.tsx')

diff --git a/src/components/CopyButton.tsx b/src/components/CopyButton.tsx
new file mode 100644
index 0000000..18a7433
--- /dev/null
+++ b/src/components/CopyButton.tsx
@@ -0,0 +1,31 @@
+import { useState } from 'react';
+import { copyToClipboard } from '../lib/clipboard';
+
+interface Props {
+  text: string;
+  label?: string;
+  className?: string;
+}
+
+export function CopyButton({ text, label = 'Copy', className = '' }: Props) {
+  const [copied, setCopied] = useState(false);
+
+  const handle = async () => {
+    const ok = await copyToClipboard(text);
+    if (ok) {
+      setCopied(true);
+      setTimeout(() => setCopied(false), 1500);
+    }
+  };
+
+  return (
+    <button
+      type="button"
+      className={`copy-btn${copied ? ' copied' : ''} ${className}`}
+      onClick={handle}
+      title={label}
+    >
+      {copied ? '✓ Copied' : label}
+    </button>
+  );
+}
-- 
cgit v1.2.3

