feat: Add theme toggle button to sidebar + flash-prevention script

This commit is contained in:
2026-05-21 10:14:00 +10:00
parent a060469adc
commit 58c5f30b0d
+11 -1
View File
@@ -7,6 +7,13 @@
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet" />
<link href="/css/admin.css" rel="stylesheet" />
<script>
// Apply saved theme immediately to prevent flash
(function() {
var t = localStorage.getItem('sb-theme') || 'dark';
document.documentElement.setAttribute('data-theme', t);
})();
</script>
@RenderSection("Styles", required: false)
</head>
<body>
@@ -42,7 +49,10 @@
</ul>
<div class="sidebar-footer">
<small>Sunbeam Framework v1.0</small>
<small>Sunbeam v1.0</small>
<button id="themeToggle" class="theme-toggle" title="Toggle theme">
<i class="bi bi-sun"></i>
</button>
</div>
</nav>