Current section

Files

Jump to
observer_web lib web components layouts root.html.heex
Raw

lib/web/components/layouts/root.html.heex

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="csrf-token" content={get_csrf_token()} />
<title>{assigns[:page_title] || "Observer Web"}</title>
<link rel="stylesheet" nonce={@csp_nonces.style} href={asset_path(@conn, :css)} />
<script nonce={@csp_nonces.script}>
const wantsDark = window.matchMedia("(prefers-color-scheme: dark)").matches
const theme = JSON.parse(localStorage.getItem("observer:theme"));
if (theme === "dark" || (theme === "system" && wantsDark) || (!theme && wantsDark)) {
document.documentElement.classList.add("dark")
} else {
document.documentElement.classList.remove("dark")
}
</script>
<script nonce={@csp_nonces.script} src={asset_path(@conn, :js)} defer>
</script>
</head>
<body class="min-h-screen antialiased bg-gray-200 dark:bg-gray-950 text-gray-900 dark:text-gray-100 transition duration-200 ease-out">
{@inner_content}
</body>
</html>