We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d5fa895 commit 3bd83c2Copy full SHA for 3bd83c2
1 file changed
modules/press-kit/CopyButton.tsx
@@ -5,11 +5,19 @@ import { Copy } from '../icons/Copy';
5
import { Check } from '../icons/Check';
6
import styles from './PressKit.module.css';
7
8
-export function CopyButton({ value, path, label = 'Copier le lien' }: { value?: string; path?: string; label?: string }) {
+export function CopyButton({
9
+ value,
10
+ path,
11
+ label = 'Copier le lien',
12
+}: {
13
+ value?: string;
14
+ path?: string;
15
+ label?: string;
16
+}) {
17
const [copied, setCopied] = useState(false);
18
19
const handleCopy = async () => {
- const text = path ? `${window.location.origin}${path}` : value ?? '';
20
+ const text = path ? `${window.location.origin}${path}` : (value ?? '');
21
await navigator.clipboard.writeText(text);
22
setCopied(true);
23
setTimeout(() => setCopied(false), 2000);
0 commit comments