refactor/add build time to page footers

This commit is contained in:
2025-07-16 10:06:41 -04:00
parent 289411c8eb
commit 8f7b0f2719
12 changed files with 28964 additions and 127 deletions

View File

@ -0,0 +1,13 @@
export function useHtmlThemeAttr () {
const [theme, setTheme] = useState(() =>
document.documentElement.getAttribute("data-theme") || "light"
);
useEffect(() => {
const handler = (e) => setTheme(e.detail);
document.addEventListener("set-theme", handler);
return () => document.removeEventListener("set-theme", handler);
}, []);
return theme;
}

View File

@ -0,0 +1,17 @@
import { useEffect } from "react";
export function usePrimeReactThemeSwitcher(theme) {
useEffect(() => {
const themeLink = document.getElementById("primereact-theme");
if (!themeLink) return;
const newTheme =
theme === "dark"
? "/themes/bootstrap4-dark-blue/theme.css"
: "/themes/bootstrap4-light-blue/theme.css";
if (themeLink.href !== newTheme) {
themeLink.href = newTheme;
}
}, [theme]);
}