Remove animation from home page

This commit is contained in:
KMKoushik
2024-05-15 19:24:09 +10:00
parent 23750d23a1
commit 2b77ef3413
3 changed files with 75 additions and 214 deletions

View File

@@ -0,0 +1,38 @@
"use client";
import React from "react";
import { Button } from "./button";
import { CheckIcon, ClipboardCopy } from "lucide-react";
export const TextWithCopyButton: React.FC<{
value: string;
className?: string;
}> = ({ value, className }) => {
const [isCopied, setIsCopied] = React.useState(false);
const copyToClipboard = async () => {
try {
await navigator.clipboard.writeText(value);
setIsCopied(true);
setTimeout(() => setIsCopied(false), 2000); // Reset isCopied to false after 2 seconds
} catch (err) {
console.error("Failed to copy: ", err);
}
};
return (
<div className={"flex gap-2 items-center group"}>
<div className={className}>{value}</div>
<Button
variant="ghost"
className="hover:bg-transparent p-0 cursor-pointer text-muted-foreground opacity-0 group-hover:opacity-100"
onClick={copyToClipboard}
>
{isCopied ? (
<CheckIcon className="h-4 w-4 text-green-500" />
) : (
<ClipboardCopy className="h-4 w-4" />
)}
</Button>
</div>
);
};