feat: Add theme toggle button to sidebar + flash-prevention script
This commit is contained in:
@@ -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@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="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet" />
|
||||||
<link href="/css/admin.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)
|
@RenderSection("Styles", required: false)
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -42,7 +49,10 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="sidebar-footer">
|
<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>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user