| 1 | import { |
| 2 | CircleCheckIcon, |
| 3 | InfoIcon, |
| 4 | Loader2Icon, |
| 5 | OctagonXIcon, |
| 6 | TriangleAlertIcon, |
| 7 | } from "lucide-react" |
| 8 | import { useTheme } from "next-themes" |
| 9 | import { Toaster as Sonner, type ToasterProps } from "sonner" |
| 10 | |
| 11 | const Toaster = ({ ...props }: ToasterProps) => { |
| 12 | const { theme = "system" } = useTheme() |
| 13 | |
| 14 | return ( |
| 15 | <Sonner |
| 16 | theme={theme as ToasterProps["theme"]} |
| 17 | className="toaster group" |
| 18 | icons={{ |
| 19 | success: <CircleCheckIcon className="size-4" />, |
| 20 | info: <InfoIcon className="size-4" />, |
| 21 | warning: <TriangleAlertIcon className="size-4" />, |
| 22 | error: <OctagonXIcon className="size-4" />, |
| 23 | loading: <Loader2Icon className="size-4 animate-spin" />, |
| 24 | }} |
| 25 | style={ |
| 26 | { |
| 27 | "--normal-bg": "var(--popover)", |
| 28 | "--normal-text": "var(--popover-foreground)", |
| 29 | "--normal-border": "var(--border)", |
| 30 | "--border-radius": "var(--radius)", |
| 31 | } as React.CSSProperties |
| 32 | } |
| 33 | {...props} |
| 34 | /> |
| 35 | ) |
| 36 | } |
| 37 | |
| 38 | export { Toaster } |