mirror of
https://gitlab.w-hs.de/an14051/backerup-website.git
synced 2026-07-27 17:35:29 +00:00
19 lines
560 B
TypeScript
19 lines
560 B
TypeScript
"use client";
|
|
|
|
export default function CopyLinkButton({ token }: { token: string }) {
|
|
function copy() {
|
|
const url = `${window.location.origin}/files/${token}`;
|
|
navigator.clipboard.writeText(url).then(() => {
|
|
alert("Link copied to clipboard!");
|
|
});
|
|
}
|
|
return (
|
|
<button
|
|
onClick={copy}
|
|
className="flex w-full items-center justify-center gap-2 rounded-xl border border-slate-700 py-3 text-sm font-semibold text-slate-300 hover:bg-slate-800 hover:text-white transition-colors"
|
|
>
|
|
Copy share link
|
|
</button>
|
|
);
|
|
}
|