Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

657 B
Raw Blame
"use client";

import { Button } from "@cap/ui";
import { faLink } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { toast } from "sonner";

export function CollectionCopyLinkButton() {
	return (
		<Button
			type="button"
			variant="gray"
			size="sm"
			onClick={async () => {
				try {
					await navigator.clipboard.writeText(
						window.location.origin + window.location.pathname,
					);
					toast.success("Link copied");
				} catch {
					toast.error("Failed to copy link");
				}
			}}
		>
			<FontAwesomeIcon icon={faLink} className="size-3" />
			Copy link
		</Button>
	);
}