Files
ember-market-frontend/components/layout/theme-toggle.tsx
g fe01f31538
Some checks failed
Build Frontend / build (push) Failing after 7s
Refactor UI imports and update component paths
Replaces imports from 'components/ui' with 'components/common' across the app and dashboard pages, and updates model and API imports to use new paths under 'lib'. Removes redundant authentication checks from several dashboard pages. Adds new dashboard components and utility files, and reorganizes hooks and services into the 'lib' directory for improved structure.
2026-01-13 05:02:13 +00:00

31 lines
819 B
TypeScript

"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>
)
}