"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>
  );
}
