Files
netbird-dashboard/src/components/CopyToClipboardText.tsx
Eduard Gert f74f9cf812 Add region and public ip to peer table and detailed peer view (#340)
* 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>
2024-02-23 15:52:33 +01:00

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>
);
}