Open History to see the last commit
1import type { RefObject } from "react";
2import { anchoredToastManager } from "./toast";
3
4export const ANCHORED_COPY_TOAST_TIMEOUT_MS = 1000;
5
6export function showAnchoredCopyErrorToast(ref: RefObject<HTMLButtonElement | null>, error: Error) {
7 if (!ref.current) return;
8 anchoredToastManager.add({
9 type: "error",
10 positionerProps: {
11 anchor: ref.current,
12 },
13 title: "Failed to copy",
14 description: error.message,
15 });
16}