Files
mantisbase-admin/components/theme-toggle.tsx
v0 a07e558cbc feat: enhance admin dashboard UX and functionality
Improve table view layout, dark theme, data protection, schema config, and documentation links. Add theme system, data protection, and professional polish.

#VERCEL_SKIP

Co-authored-by: Allan K. Koech <44490960+allankoechke@users.noreply.github.com>
2025-06-23 12:44:58 +00:00

32 lines
810 B
TypeScript

"use client"
import * as React from "react"
import { Moon, Sun } from "lucide-react"
import { useTheme } from "next-themes"
import { SidebarMenuButton } from "@/components/ui/sidebar"
export function ThemeToggle() {
const { theme, setTheme } = useTheme()
const [mounted, setMounted] = React.useState(false)
React.useEffect(() => {
setMounted(true)
}, [])
if (!mounted) {
return (
<SidebarMenuButton>
<div className="h-4 w-4" />
<span>Theme</span>
</SidebarMenuButton>
)
}
return (
<SidebarMenuButton onClick={() => setTheme(theme === "dark" ? "light" : "dark")}>
{theme === "dark" ? <Sun className="h-4 w-4" /> : <Moon className="h-4 w-4" />}
<span>{theme === "dark" ? "Light Mode" : "Dark Mode"}</span>
</SidebarMenuButton>
)
}