2024-08-07 16:37:54 -05:00
|
|
|
"use client";
|
|
|
|
|
import { useState } from "react";
|
|
|
|
|
import { Button } from "../ui/button";
|
|
|
|
|
import toast from "react-hot-toast";
|
|
|
|
|
import { Check } from "lucide-react";
|
|
|
|
|
|
|
|
|
|
export function TextCopyComp() {
|
|
|
|
|
"use client";
|
|
|
|
|
const [textCopied, setTextCopied] = useState(false);
|
|
|
|
|
|
|
|
|
|
return (
|
2024-08-08 18:02:46 -05:00
|
|
|
<code className="border p-3 rounded">
|
2024-08-07 16:37:54 -05:00
|
|
|
MHSFPV.minehut.gg{" "}
|
|
|
|
|
<Button
|
|
|
|
|
size="icon"
|
2024-08-08 18:02:46 -05:00
|
|
|
className="ml-1 h-[20px]"
|
2024-08-07 16:37:54 -05:00
|
|
|
onClick={() => {
|
|
|
|
|
setTextCopied(true);
|
|
|
|
|
navigator.clipboard.writeText("MHSFPV.minehut.gg");
|
|
|
|
|
toast.success("Copied!");
|
|
|
|
|
setTimeout(() => setTextCopied(false), 1000);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{textCopied ? (
|
2024-08-08 18:02:46 -05:00
|
|
|
<Check size={16} className="flex items-center" />
|
2024-08-07 16:37:54 -05:00
|
|
|
) : (
|
|
|
|
|
<p>Copy</p>
|
|
|
|
|
)}
|
|
|
|
|
</Button>
|
|
|
|
|
</code>
|
|
|
|
|
);
|
|
|
|
|
}
|