mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-13 12:13:42 +01:00
23 lines
589 B
TypeScript
23 lines
589 B
TypeScript
import {
|
|
CopyIconButton as BaseCopyIconButton,
|
|
type CopyIconButtonProps,
|
|
} from "@yaakapp-internal/ui";
|
|
import { copyToClipboard } from "../lib/copy";
|
|
import { showToast } from "../lib/toast";
|
|
|
|
export function CopyIconButton(props: Omit<CopyIconButtonProps, "copy" | "onCopyFailed">) {
|
|
return <BaseCopyIconButton {...props} copy={copy} onCopyFailed={showCopyFailed} />;
|
|
}
|
|
|
|
function copy(text: string) {
|
|
copyToClipboard(text, { disableToast: true });
|
|
}
|
|
|
|
function showCopyFailed() {
|
|
showToast({
|
|
id: "failed-to-copy",
|
|
color: "danger",
|
|
message: "Failed to copy",
|
|
});
|
|
}
|