File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1
1
"use client"
2
2
3
+ import { BsCopy } from "react-icons/bs"
4
+ import { FaRegCheckCircle } from "react-icons/fa"
5
+
3
6
import { cn } from "@/lib/utils/cn"
4
7
8
+ import { Button , type ButtonProps } from "./ui/buttons/Button"
9
+
5
10
import { useClipboard } from "@/hooks/useClipboard"
6
11
7
12
export type CopyToClipboardProps = {
@@ -27,4 +32,17 @@ const CopyToClipboard = ({
27
32
)
28
33
}
29
34
35
+ type CopyButtonProps = ButtonProps & {
36
+ message : string
37
+ }
38
+
39
+ export const CopyButton = ( { message, ...props } : CopyButtonProps ) => {
40
+ const { onCopy, hasCopied } = useClipboard ( { timeout : 1500 } )
41
+ return (
42
+ < Button variant = "ghost" onClick = { ( ) => onCopy ( message ) } { ...props } >
43
+ { hasCopied ? < FaRegCheckCircle /> : < BsCopy /> }
44
+ </ Button >
45
+ )
46
+ }
47
+
30
48
export default CopyToClipboard
You can’t perform that action at this time.
0 commit comments