@@ -2,11 +2,13 @@ import Head from "next/head";
22import { useRouter } from "next/router" ;
33import { useState , useEffect } from "react" ;
44import NextLink from "next/link" ;
5+ import { useTheme } from "next-themes" ;
56
67import Footer from "@/components/Footer" ;
78
89export default function Container ( props ) {
910 const [ mounted , setMounted ] = useState ( false ) ;
11+ const { theme, setTheme } = useTheme ( ) ;
1012
1113 // After mounting, we have access to the theme
1214 useEffect ( ( ) => setMounted ( true ) , [ ] ) ;
@@ -54,7 +56,7 @@ export default function Container(props) {
5456 aria-label = "Toggle Dark Mode"
5557 type = "button"
5658 className = "bg-gray-200 dark:bg-gray-800 rounded p-3 h-10 w-10"
57- // onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
59+ onClick = { ( ) => setTheme ( theme === "dark" ? "light" : "dark" ) }
5860 >
5961 { mounted && (
6062 < svg
@@ -64,21 +66,21 @@ export default function Container(props) {
6466 stroke = "currentColor"
6567 className = "h-4 w-4 text-gray-800 dark:text-gray-200"
6668 >
67- { /* { theme === "dark" ? (
69+ { theme === "dark" ? (
6870 < path
6971 strokeLinecap = "round"
7072 strokeLinejoin = "round"
7173 strokeWidth = { 2 }
7274 d = "M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"
7375 />
74- ) : ( */ }
75- < path
76- strokeLinecap = "round"
77- strokeLinejoin = "round"
78- strokeWidth = { 2 }
79- d = "M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"
80- />
81- { /* )} */ }
76+ ) : (
77+ < path
78+ strokeLinecap = "round"
79+ strokeLinejoin = "round"
80+ strokeWidth = { 2 }
81+ d = "M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"
82+ />
83+ ) }
8284 </ svg >
8385 ) }
8486 </ button >
@@ -109,7 +111,7 @@ export default function Container(props) {
109111 </ nav >
110112 < main
111113 id = "skip"
112- className = "flex flex-col justify-center bg-white dark:bg-black px-8"
114+ className = "flex flex-col justify-center bg-white dark:bg-black px-8 text-gray-900 dark:text-gray-100 "
113115 >
114116 { children }
115117 < Footer />
0 commit comments