Files
Reactive-Resume/src/components/ui/sonner.tsx
T
Amruth Pillai 192880e416 use vite+
2026-03-18 22:03:24 +01:00

41 lines
1.2 KiB
TypeScript

import { CheckCircleIcon, InfoIcon, SpinnerIcon, WarningIcon, XCircleIcon } from "@phosphor-icons/react";
import { Toaster as Sonner, type ToasterProps } from "sonner";
import { useTheme } from "../theme/provider";
const Toaster = ({ ...props }: ToasterProps) => {
const { theme = "system" } = useTheme();
return (
<Sonner
theme={theme as ToasterProps["theme"]}
className="toaster group print:hidden"
icons={{
success: <CheckCircleIcon className="size-4" />,
info: <InfoIcon className="size-4" />,
warning: <WarningIcon className="size-4" />,
error: <XCircleIcon className="size-4" />,
loading: <SpinnerIcon className="size-4 animate-spin" />,
}}
style={
{
"--normal-bg": "var(--popover)",
"--normal-text": "var(--popover-foreground)",
"--normal-border": "var(--border)",
"--border-radius": "var(--radius)",
} as React.CSSProperties
}
toastOptions={{
classNames: {
toast: "cn-toast",
content: "space-y-0.5",
description: "text-muted-foreground opacity-60 text-xs",
},
}}
{...props}
/>
);
};
export { Toaster };