Add dark mode toggle via next-themes
Uses next-themes with system default. Toggle button in sidebar switches between light/dark and persists to localStorage. CSS variables for dark mode were already defined in globals.css. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
11
src/components/layout/ThemeProvider.tsx
Normal file
11
src/components/layout/ThemeProvider.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
'use client'
|
||||
|
||||
import { ThemeProvider as NextThemesProvider } from 'next-themes'
|
||||
|
||||
export function ThemeProvider({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<NextThemesProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
|
||||
{children}
|
||||
</NextThemesProvider>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user