diff options
| author | joonhoekim <26rote@gmail.com> | 2025-03-25 15:55:45 +0900 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-03-25 15:55:45 +0900 |
| commit | 1a2241c40e10193c5ff7008a7b7b36cc1d855d96 (patch) | |
| tree | 8a5587f10ca55b162d7e3254cb088b323a34c41b /components/ui/toasterSonner.tsx | |
initial commit
Diffstat (limited to 'components/ui/toasterSonner.tsx')
| -rw-r--r-- | components/ui/toasterSonner.tsx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/components/ui/toasterSonner.tsx b/components/ui/toasterSonner.tsx new file mode 100644 index 00000000..6028f0cd --- /dev/null +++ b/components/ui/toasterSonner.tsx @@ -0,0 +1,32 @@ +"use client" + +import { useTheme } from "next-themes" +import { Toaster as Sonner } from "sonner" + +type ToasterProps = React.ComponentProps<typeof Sonner> + +function ToasterSonner({ ...props }: ToasterProps) { + const { theme = "system" } = useTheme() + + return ( + <Sonner + theme={theme as ToasterProps["theme"]} + // eslint-disable-next-line tailwindcss/no-custom-classname + 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-foreground", + cancelButton: + "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground", + }, + }} + {...props} + /> + ) +} + +export { ToasterSonner } |
