Skip to content

Commit

Permalink
feat: replace Toaster with SonnerToast component for theme integration
Browse files Browse the repository at this point in the history
Signed-off-by: Jubayer <[email protected]>
  • Loading branch information
ajshovon committed Dec 4, 2024
1 parent 34490db commit 634780b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/web/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { AuthProvider } from '@/providers/authContext';
import SonnerToast from '@/providers/SonnerToast';
import { SiteThemeProviders } from '@/providers/theme.provider';
import '@/styles/globals.css';
import type { Metadata } from 'next';
import { ThemeProvider } from 'next-themes';
import { Inter } from 'next/font/google';
import { Toaster } from 'sonner';

const inter = Inter({
subsets: ['latin'],
Expand Down Expand Up @@ -36,7 +36,7 @@ export default function RootLayout({
<SiteThemeProviders>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
{children}
<Toaster />
<SonnerToast />
</ThemeProvider>
</SiteThemeProviders>
</AuthProvider>
Expand Down
10 changes: 10 additions & 0 deletions apps/web/providers/SonnerToast.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use client';
import { useTheme } from 'next-themes';
import { Toaster, ToasterProps } from 'sonner';

const SonnerToast = () => {
const { theme } = useTheme();
return <Toaster theme={theme as ToasterProps['theme']} />;
};

export default SonnerToast;

0 comments on commit 634780b

Please sign in to comment.