This commit is contained in:
g
2025-02-07 04:43:47 +00:00
parent d3e19c7e09
commit 6c4f3f0866
94 changed files with 11777 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
"use client"
import * as React from "react"
import { Moon, Sun } from "lucide-react"
import { useTheme } from "next-themes"
export function ThemeToggle() {
const [mounted, setMounted] = React.useState(false)
const { theme, setTheme } = useTheme()
React.useEffect(() => {
setMounted(true)
}, [])
if (!mounted) {
return null
}
return (
<button
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
className="relative p-2 hover:bg-gray-100 dark:hover:bg-[#1F1F23] rounded-full transition-colors"
>
<Sun className="h-5 w-5 text-gray-600 dark:text-gray-300 transition-all dark:hidden" />
<Moon className="h-5 w-5 text-gray-600 dark:text-gray-300 transition-all hidden dark:block" />
<span className="sr-only">Toggle theme</span>
</button>
)
}