mirror of
https://github.com/Dokploy/website.git
synced 2026-06-28 02:25:25 +02:00
- Standardized import statements across various components to use double quotes for consistency. - Updated component files to ensure proper formatting and adherence to coding standards. - Enhanced overall code readability by aligning code structure and improving comment clarity. - Made minor adjustments to ensure all components follow the same coding conventions, improving maintainability.
33 lines
772 B
TypeScript
33 lines
772 B
TypeScript
"use client";
|
|
|
|
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
import { useState } from "react";
|
|
|
|
interface CopyButtonProps {
|
|
text: string;
|
|
}
|
|
|
|
export function CopyButton({ text }: CopyButtonProps) {
|
|
const [isCopied, setIsCopied] = useState(false);
|
|
|
|
const copy = async () => {
|
|
await navigator.clipboard.writeText(text);
|
|
setIsCopied(true);
|
|
setTimeout(() => setIsCopied(false), 2000);
|
|
};
|
|
|
|
return (
|
|
<button
|
|
className="absolute right-4 top-4 z-20 h-8 w-8 rounded-md border bg-background/50 p-1.5 backdrop-blur-sm transition-all hover:bg-background/80"
|
|
onClick={copy}
|
|
type="button"
|
|
>
|
|
{isCopied ? (
|
|
<CheckIcon className="h-full w-full text-green-500" />
|
|
) : (
|
|
<CopyIcon className="h-full w-full text-gray-400" />
|
|
)}
|
|
</button>
|
|
);
|
|
}
|