FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
processing-website/src/components/CopyButton.js at main · processing/processing-website · GitHub
processing
processing-website
Repository navigation
Code
Issues
112
(112)
Pull requests
16
(16)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
processing-website
/
src
/
components
/
CopyButton.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (26 loc) · 763 Bytes
Breadcrumbs
processing-website
/
src
/
components
/
CopyButton.js
Copy path
File metadata and controls
33 lines (26 loc) · 763 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
32
33
import
React
,
{
useState
}
from
'react'
;
import
classnames
from
'classnames'
;
import
CopyToClipboard
from
'./CopyToClipboard'
;
import
CopyIcon
from
'../images/copy-icon.svg'
;
import
*
as
css
from
'./CopyButton.module.css'
;
const
CopyButton
=
(
{
text
}
)
=>
{
const
[
isCopied
,
setIsCopied
]
=
useState
(
false
)
;
const
onCopy
=
(
text
,
res
)
=>
{
if
(
res
)
{
setIsCopied
(
true
)
;
setTimeout
(
(
)
=>
{
setIsCopied
(
false
)
;
}
,
1000
)
;
}
}
;
return
(
<
CopyToClipboard
text
=
{
text
}
onCopy
=
{
onCopy
}
>
<
button
type
=
"button"
className
=
{
classnames
(
css
.
root
,
{
[
css
.
copied
]
:
isCopied
}
)
}
>
<
CopyIcon
/>
{
isCopied
?
'Copied'
:
'Copy'
}
</
button
>
</
CopyToClipboard
>
)
;
}
;
export
default
CopyButton
;
Back
|
FazBrowse Home
|
New Git URL