mirror of
https://github.com/netbirdio/dashboard.git
synced 2026-01-26 01:21:04 +00:00
* Fix group badge icon size * Fix copy icon size * Add region information to peer table and single peer view * Push to docker * Change login expired icon size * Fix country flag in single peer view * Change country flag size in peer table * Disable revalidation for countries * Fix icon size on peer detail view * Rollback workflow * Revert login expiration --------- Co-authored-by: Maycon Santos <mlsmaycon@gmail.com>
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import { cn } from "@utils/helpers";
|
|
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
import React from "react";
|
|
import useCopyToClipboard from "@/hooks/useCopyToClipboard";
|
|
|
|
type Props = {
|
|
children: React.ReactNode;
|
|
message?: string;
|
|
};
|
|
|
|
export default function CopyToClipboardText({ children, message }: Props) {
|
|
const [wrapper, copyToClipboard, copied] = useCopyToClipboard();
|
|
|
|
return (
|
|
<div
|
|
className={cn(
|
|
"flex gap-2 items-center group cursor-pointer transition-all hover:underline underline-offset-4 decoration-dashed decoration-nb-gray-600",
|
|
!copied && "hover:opacity-90",
|
|
)}
|
|
onClick={(e) => {
|
|
e.stopPropagation();
|
|
e.preventDefault();
|
|
copyToClipboard(message).then();
|
|
}}
|
|
ref={wrapper}
|
|
>
|
|
{children}
|
|
|
|
{copied ? (
|
|
<CheckIcon
|
|
className={
|
|
"text-nb-gray-100 opacity-0 group-hover:opacity-100 shrink-0"
|
|
}
|
|
size={12}
|
|
/>
|
|
) : (
|
|
<CopyIcon
|
|
className={
|
|
"text-nb-gray-100 opacity-0 group-hover:opacity-100 shrink-0"
|
|
}
|
|
size={12}
|
|
/>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|