import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon } from "lucide-react";
import { useTheme } from "next-themes";
import { Toaster as Sonner, type ToasterProps } from "sonner";
import { buttonVariants } from "~/components/ui/button.tsx";
const Toaster = ({ ...props }: ToasterProps) => {
const { theme = "system" } = useTheme();
return (
,
info: ,
warning: ,
error: ,
loading: ,
}}
style={
{
"--normal-bg": "var(--popover)",
"--normal-text": "var(--popover-foreground)",
"--normal-border": "var(--border)",
"--border-radius": "var(--radius)",
pointerEvents: "none",
} as React.CSSProperties
}
toastOptions={{
// 提示条是 pg-float 玻璃,状态色只在图标上(不开 richColors)
unstyled: true,
classNames: {
toast:
"pg-float rounded-2xl w-full flex items-start gap-2.5 px-3.5 py-2.5 text-caption text-popover-foreground",
title: "font-medium leading-relaxed",
description: "mt-1 text-caption text-muted-foreground",
content: "min-w-0 flex-1",
icon: "mt-0.5 shrink-0 flex items-center justify-center",
error: "[&_[data-icon]]:text-destructive",
warning: "[&_[data-icon]]:text-warning",
success: "[&_[data-icon]]:text-success",
actionButton: buttonVariants({ size: "sm" }),
cancelButton: buttonVariants({ variant: "outline", size: "sm" }),
},
style: { pointerEvents: "auto" },
}}
{...props}
/>
);
};
export { Toaster };