File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 3
3
import { useEffect } from 'react' ;
4
4
import { ThemeProvider , useTheme } from 'next-themes' ;
5
5
import { RecoilRoot } from 'recoil' ;
6
+ import { usePathname } from 'next/navigation' ;
7
+
8
+ const FORCE_DARK_MODE_PAGES = [ '/' ] ;
6
9
7
10
function ThemeWatcher ( ) {
8
11
let { resolvedTheme, setTheme } = useTheme ( ) ;
@@ -29,8 +32,14 @@ function ThemeWatcher() {
29
32
}
30
33
31
34
export function Providers ( { children } : { children : React . ReactNode } ) {
35
+ const pathname = usePathname ( ) ;
36
+ const website = FORCE_DARK_MODE_PAGES . includes ( pathname ) ;
32
37
return (
33
- < ThemeProvider attribute = "class" disableTransitionOnChange >
38
+ < ThemeProvider
39
+ attribute = "class"
40
+ disableTransitionOnChange
41
+ forcedTheme = { website ? 'dark' : undefined }
42
+ >
34
43
< ThemeWatcher />
35
44
< RecoilRoot > { children } </ RecoilRoot >
36
45
</ ThemeProvider >
You can’t perform that action at this time.
0 commit comments