From d706380409cfff0d25594eec94a62e3d59f0dde1 Mon Sep 17 00:00:00 2001 From: Zhenya Goroh Date: Sun, 29 Sep 2024 00:11:26 +0300 Subject: [PATCH] Added CopyButton component --- src/components/ui/copy-button.tsx | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/components/ui/copy-button.tsx diff --git a/src/components/ui/copy-button.tsx b/src/components/ui/copy-button.tsx new file mode 100644 index 0000000..806b5d3 --- /dev/null +++ b/src/components/ui/copy-button.tsx @@ -0,0 +1,34 @@ +"use client"; + +import * as React from "react"; + +import { Button } from "@/components/ui/button"; +import { CopyIcon } from "@radix-ui/react-icons"; + +import { useClipboard } from "@/lib/hooks"; + +const CopyButton = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & { + valueToCopy: string; + } +>(({ className, valueToCopy, ...props }, ref) => { + const copyToClipboard = useClipboard(valueToCopy); + + return ( + <> + + + ); +}); + +export { CopyButton };