mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-06-05 17:55:32 -04:00
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import {
|
|
IconAlertTriangle,
|
|
IconCircleCheck,
|
|
IconCircleX,
|
|
IconInfoCircle,
|
|
} from "@tabler/icons-react";
|
|
import { useTheme } from "next-themes";
|
|
import { Toaster as Sonner, type ToasterProps } from "sonner";
|
|
|
|
import { Spinner } from "@/components/ui/spinner";
|
|
|
|
const Toaster = ({ ...props }: ToasterProps) => {
|
|
const { theme = "system" } = useTheme();
|
|
|
|
return (
|
|
<Sonner
|
|
theme={theme as ToasterProps["theme"]}
|
|
className="toaster group"
|
|
icons={{
|
|
success: <IconCircleCheck className="size-4" />,
|
|
info: <IconInfoCircle className="size-4" />,
|
|
warning: <IconAlertTriangle className="size-4" />,
|
|
error: <IconCircleX className="size-4" />,
|
|
loading: <Spinner className="size-4" />,
|
|
}}
|
|
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",
|
|
},
|
|
}}
|
|
{...props}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export { Toaster };
|