diff --git a/src/components/header/index.tsx b/src/components/header/index.tsx
index 38f5b87..5655b69 100644
--- a/src/components/header/index.tsx
+++ b/src/components/header/index.tsx
@@ -1,9 +1,57 @@
-import React from "react"
+import React, { useEffect, useState } from "react"
import { DiGithubBadge } from "react-icons/di"
import { MdSettings } from "react-icons/md"
import Link from "next/link"
+import { useTheme } from "next-themes"
export function Header() {
+ const { theme, systemTheme, setTheme } = useTheme()
+ const [mounted, setMounted] = useState(false)
+
+ useEffect(() => {
+ setMounted(true)
+ }, [])
+
+ const renderThemeToggle = () => {
+ if (!mounted) return null
+
+ const currentTheme = theme === "system" ? systemTheme : theme
+
+ if (currentTheme === "dark") {
+ return (
+
+ )
+ } else {
+ return (
+
+ )
+ }
+ }
+
return (
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
index 674ffd6..1293275 100644
--- a/src/pages/_app.tsx
+++ b/src/pages/_app.tsx
@@ -1,6 +1,7 @@
import "../styles/global.css"
import { AppProps } from "next/app"
import { useEffect, useState } from "react"
+import { ThemeProvider } from "next-themes"
export default function App({ Component, pageProps }: AppProps) {
const [keys, setKeys] = useState<{
@@ -17,5 +18,9 @@ export default function App({ Component, pageProps }: AppProps) {
})()
}, [])
- return
+ return (
+
+
+
+ )
}
diff --git a/tailwind.config.js b/tailwind.config.js
index f4132ae..d31caa7 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -1,18 +1,19 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
- "./src/pages/**/*.{js,ts,jsx,tsx}",
- "./src/components/**/*.{js,ts,jsx,tsx}",
- "./src/views/**/*.{js,ts,jsx,tsx}",
+ "./src/pages/**/*.{js,ts,jsx,tsx}",
+ "./src/components/**/*.{js,ts,jsx,tsx}",
+ "./src/views/**/*.{js,ts,jsx,tsx}",
],
+ darkMode: "class",
theme: {
extend: {
colors: {
- 'custom-green-light': '#6b9370',
- 'custom-green-dark': '#4D6A51',
- 'custom-black': '#3C3744'
- }
- }
+ "custom-green-light": "#6b9370",
+ "custom-green-dark": "#4D6A51",
+ "custom-black": "#3C3744",
+ },
+ },
},
plugins: [],
}