zzz / frontend /src /components /shared /buttons /copy-to-clipboard-button.tsx
ar08's picture
Upload 1040 files
246d201 verified
raw
history blame contribute delete
763 Bytes
import CheckmarkIcon from "#/icons/checkmark.svg?react";
import CopyIcon from "#/icons/copy.svg?react";
interface CopyToClipboardButtonProps {
isHidden: boolean;
isDisabled: boolean;
onClick: () => void;
mode: "copy" | "copied";
}
export function CopyToClipboardButton({
isHidden,
isDisabled,
onClick,
mode,
}: CopyToClipboardButtonProps) {
return (
<button
hidden={isHidden}
disabled={isDisabled}
data-testid="copy-to-clipboard"
type="button"
onClick={onClick}
className="button-base p-1 absolute top-1 right-1"
>
{mode === "copy" && <CopyIcon width={15} height={15} />}
{mode === "copied" && <CheckmarkIcon width={15} height={15} />}
</button>
);
}