mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-15 15:26:59 +10:00
41 lines
1.2 KiB
TypeScript
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 };
|