Sidebar now separates Dashboard/Mein Profil/Mitglieder from Raids/ Premades with a thin divider, keeping the existing Admin section as its own group below. On narrow screens the sidebar no longer collapses into a horizontal icon strip - it becomes a full off-canvas drawer (same layout and labels as desktop) toggled by a hamburger button in a new mobile top bar, with a backdrop and Escape/backdrop-click/link-click to close (assets/js/nav.js). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
(function () {
|
|
'use strict';
|
|
|
|
var toggle = document.querySelector('.sidebar-toggle');
|
|
var sidebar = document.querySelector('.sidebar');
|
|
var backdrop = document.querySelector('.sidebar-backdrop');
|
|
if (!toggle || !sidebar || !backdrop) return;
|
|
|
|
function openSidebar() {
|
|
sidebar.classList.add('open');
|
|
backdrop.classList.add('open');
|
|
toggle.setAttribute('aria-expanded', 'true');
|
|
}
|
|
|
|
function closeSidebar() {
|
|
sidebar.classList.remove('open');
|
|
backdrop.classList.remove('open');
|
|
toggle.setAttribute('aria-expanded', 'false');
|
|
}
|
|
|
|
toggle.addEventListener('click', function () {
|
|
if (sidebar.classList.contains('open')) {
|
|
closeSidebar();
|
|
} else {
|
|
openSidebar();
|
|
}
|
|
});
|
|
|
|
backdrop.addEventListener('click', closeSidebar);
|
|
|
|
sidebar.querySelectorAll('.sidebar-link').forEach(function (link) {
|
|
link.addEventListener('click', closeSidebar);
|
|
});
|
|
|
|
document.addEventListener('keydown', function (e) {
|
|
if (e.key === 'Escape') closeSidebar();
|
|
});
|
|
})();
|