File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ permissions:
3030 deployments : write
3131
3232env :
33- NODE_VERSION : ' 20 .x'
33+ NODE_VERSION : ' 18 .x'
3434 CACHE_NAME : ' node-modules-v1'
3535
3636# Cancel previous runs if a new commit is pushed
Original file line number Diff line number Diff line change @@ -4,29 +4,21 @@ import * as React from "react";
44import { Moon , Sun } from "lucide-react" ;
55import { useTheme } from "next-themes" ;
66
7- /**
8- * Theme toggle component that switches between light and dark modes.
9- * Displays sun icon in light mode and moon icon in dark mode with smooth transitions.
10- *
11- * @component
12- * @returns {JSX.Element | null } The theme toggle button or null during SSR
13- */
147export function ThemeToggle ( ) {
158 const [ mounted , setMounted ] = React . useState ( false ) ;
16- const { theme , setTheme } = useTheme ( ) ;
9+ const { resolvedTheme , setTheme } = useTheme ( ) ; // Changed: use resolvedTheme
1710
1811 React . useEffect ( ( ) => {
1912 setMounted ( true ) ;
2013 } , [ ] ) ;
2114
22- // Prevent hydration mismatch by not rendering on server
2315 if ( ! mounted ) {
2416 return null ;
2517 }
2618
2719 return (
2820 < button
29- onClick = { ( ) => setTheme ( theme === "dark" ? "light" : "dark" ) }
21+ onClick = { ( ) => setTheme ( resolvedTheme === "dark" ? "light" : "dark" ) } // Changed: use resolvedTheme
3022 className = "relative inline-flex h-10 w-10 items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors"
3123 aria-label = "Toggle theme"
3224 >
@@ -35,4 +27,4 @@ export function ThemeToggle() {
3527 < span className = "sr-only" > Toggle theme</ span >
3628 </ button >
3729 ) ;
38- }
30+ }
You can’t perform that action at this time.
0 commit comments