backoffice nextJs replaces admin in rust

This commit is contained in:
2026-03-05 15:47:18 +01:00
parent 20f9af6cba
commit 3a96f6ba36
24 changed files with 1765 additions and 9 deletions

View File

@@ -0,0 +1,28 @@
"use client";
import { useEffect, useState } from "react";
import { useTheme } from "next-themes";
export function ThemeToggle() {
const { theme, setTheme, resolvedTheme } = useTheme();
const [mounted, setMounted] = useState(false);
useEffect(() => {
setMounted(true);
}, []);
const activeTheme = theme === "system" ? resolvedTheme : theme;
const nextTheme = activeTheme === "dark" ? "light" : "dark";
return (
<button
type="button"
className="theme-toggle"
onClick={() => setTheme(nextTheme)}
aria-label="Toggle color theme"
disabled={!mounted}
>
{mounted ? (activeTheme === "dark" ? "Dark" : "Light") : "Theme"}
</button>
);
}