MCPcopy Create free account
hub / github.com/triggerdotdev/jsonhero-web / CopyTextButton

Function CopyTextButton

app/components/CopyTextButton.tsx:11–31  ·  view source on GitHub ↗
({ value, className }: CopyTextButtonProps)

Source from the content-addressed store, hash-verified

9};
10
11export function CopyTextButton({ value, className }: CopyTextButtonProps) {
12 const [copied, setCopied] = useState(false);
13 const onCopied = useCallback(() => {
14 setCopied(true);
15 const timeout = setTimeout(() => {
16 setCopied(false);
17 }, 1500);
18 }, [value]);
19 return (
20 <CopyText className={`${className}`} value={value} onCopied={onCopied}>
21 {copied ? (
22 <Body>Copied!</Body>
23 ) : (
24 <div className="flex items-center">
25 <ClipboardIcon className="h-4 w-4 mr-[2px]" />
26 <Body>Copy</Body>
27 </div>
28 )}
29 </CopyText>
30 );
31}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected