MCPcopy Create free account
hub / github.com/amaancoderx/skillui / useCopy

Function useCopy

components/CodeBlock.tsx:31–48  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

29}
30
31function useCopy(text: string) {
32 const [copied, setCopied] = useState(false)
33 const copy = async () => {
34 try {
35 await navigator.clipboard.writeText(text)
36 } catch {
37 const el = document.createElement('textarea')
38 el.value = text
39 document.body.appendChild(el)
40 el.select()
41 document.execCommand('copy')
42 document.body.removeChild(el)
43 }
44 setCopied(true)
45 setTimeout(() => setCopied(false), 2000)
46 }
47 return { copied, copy }
48}
49
50function CodeLines({ code }: { code: string }) {
51 return (

Callers 3

TerminalBlockFunction · 0.85
EditorBlockFunction · 0.85
InlineBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected