Files
frigate/web/src/components/ui/sonner.tsx
T

35 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-02-05 16:54:08 -07:00
import { useTheme } from "next-themes";
import { Toaster as Sonner } from "sonner";
type ToasterProps = React.ComponentProps<typeof Sonner>;
const Toaster = ({ ...props }: ToasterProps) => {
const { theme = "system" } = useTheme();
return (
<Sonner
theme={theme as ToasterProps["theme"]}
className="toaster group"
toastOptions={{
classNames: {
toast:
"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
description: "group-[.toast]:text-muted-foreground",
actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary",
2024-02-05 16:54:08 -07:00
cancelButton:
"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
2024-05-04 14:54:50 -05:00
closeButton:
2026-04-14 09:19:50 -05:00
"group-[.toast]:bg-secondary group-[.toast]:text-primary group-[.toast]:border-primary group-[.toast]:border-[1px]",
2024-02-05 16:54:08 -07:00
success:
"group toast group-[.toaster]:bg-success group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
error:
"group toast group-[.toaster]:bg-danger group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
2024-02-05 16:54:08 -07:00
},
}}
{...props}
/>
);
};
export { Toaster };