deno.land / x / netzo@0.5.16 / components / icon-copy.tsx
12345678910111213141516171819202122232425262728293031// @deno-types="npm:@types/react@18.2.60"import * as React from "react";
import { useSignal } from "@preact/signals";import { cn } from "./utils.ts";
type IconCopyProps = { value: string; tooltip?: string;};
export function IconCopy({ value, tooltip = "Copy" }: IconCopyProps) { const isCopied = useSignal(false); const handleCopy = () => { navigator.clipboard.writeText(value); isCopied.value = true; setTimeout(() => isCopied.value = false, 500); };
return ( <div onClick={handleCopy} title={tooltip} className={cn( "mdi-content-copy mx-2 text-[10px]", isCopied.value ? "text-primary" : "text-gray-500 cursor-pointer", )} /> );}
Version Info