spazio-solazzo/lib/spazio_solazzo_web/components/layouts/root.html.heex
2026-01-10 19:03:02 +01:00

48 lines
1.8 KiB
Text

<!DOCTYPE html>
<html lang="en">
<head>
{Application.get_env(:live_debugger, :live_debugger_tags)}
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} />
<.live_title default="SpazioSolazzo">
{assigns[:page_title]}
</.live_title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;900&family=Montserrat:wght@300;400;500;600;700;800&display=swap"
rel="stylesheet"
/>
<link phx-track-static rel="stylesheet" href={~p"/assets/css/app.css"} />
<script defer phx-track-static type="text/javascript" src={~p"/assets/js/app.js"}>
</script>
<script>
(() => {
const setTheme = (theme) => {
localStorage.setItem("phx:theme", theme);
document.documentElement.setAttribute("data-theme", theme);
};
if (!document.documentElement.hasAttribute("data-theme")) {
setTheme(localStorage.getItem("phx:theme") || "light");
}
window.addEventListener("storage", (e) => e.key === "phx:theme" && setTheme(e.newValue || "light"));
window.addEventListener("phx:set-theme", (e) => {
let theme = e.detail?.theme || e.target?.dataset?.phxTheme;
if (theme === "toggle") {
const currentTheme = localStorage.getItem("phx:theme") || "light";
theme = currentTheme === "light" ? "dark" : "light";
}
if (theme) setTheme(theme);
});
})();
</script>
</head>
<body class="flex flex-col min-h-screen">
{@inner_content}
</body>
</html>