import { useCopyToClipboard } from "~/hooks/useCopyToClipboard"; import { cn } from "~/lib/utils"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; export function PullRequestCopyableCode({ value, target, copyLabel, copiedLabel, className, tooltipSide = "top", onError, }: { readonly value: string; readonly target: string; readonly copyLabel: string; readonly copiedLabel: string; readonly className?: string; readonly tooltipSide?: "top" | "bottom"; readonly onError?: (error: Error) => void; }) { const { copyToClipboard, isCopied } = useCopyToClipboard({ target, timeout: 1600, ...(onError ? { onError } : {}), }); return ( copyToClipboard(value)} /> } > {value} {`${isCopied ? "Copied" : copyLabel}: ${value}`} ); }