feat(theme): add dark mode with next-themes and settings toggle
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
"use client"
|
||||
|
||||
import { useAuthStore } from "@/store/auth"
|
||||
import { useTheme } from "next-themes"
|
||||
import { useEffect } from "react"
|
||||
|
||||
export function ThemeSyncEffect() {
|
||||
const { setTheme } = useTheme()
|
||||
const isAuthenticated = useAuthStore((s) => s.isAuthenticated)
|
||||
const themePreference = useAuthStore((s) => s.themePreference)
|
||||
|
||||
useEffect(() => {
|
||||
setTheme(themePreference)
|
||||
}, [isAuthenticated, themePreference, setTheme])
|
||||
|
||||
return null
|
||||
}
|
||||
Reference in New Issue
Block a user