Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): add close icon for slow request toast #2040

Closedkendalled(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/2040/headopened View on GitHub

Showing 2 changed files with 38 additions and 1 deletion.

x
0 of 2 viewed, 2 left
35 additions and 1 deletionapps/web/src/components/ui/toast.tsxModified
View file
@@ -12,6 +12,7 @@
InfoIcon,
LoaderCircleIcon,
TriangleAlertIcon,
+ XIcon,
} from "lucide-react";
​
import { cn } from "~/lib/utils";
@@ -31,6 +32,7 @@
tooltipStyle?: boolean;
dismissAfterVisibleMs?: number;
hideCopyButton?: boolean;
+ showCloseButton?: boolean;
};
​
const toastManager = Toast.createToastManager<ThreadToastData>();
@@ -302,9 +304,23 @@
dismissAfterVisibleMs={toast.data?.dismissAfterVisibleMs}
toastId={toast.id}
+ {toast.data?.showCloseButton ? (
+ <button
+ aria-label="Dismiss notification"
+ className={cn(
+ buttonVariants({ size: "icon-xs", variant: "ghost" }),
+ "absolute top-2 right-2 z-10 size-5 rounded-sm p-0 text-muted-foreground hover:text-foreground",
+ )}
+ onClick={() => toastManager.close(toast.id)}