deno.land / x / netzo@0.5.16 / components / icon-copy.tsx

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// @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", )} /> );}
netzo

Version Info

Tagged at
3 weeks ago