Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

anchoredCopyToast.ts

16 lines445 Bytes

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