Nav: group sidebar links, add mobile slide-out drawer
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>
This commit is contained in:
parent
c8d9fb6baf
commit
1fb6a5fabd
5 changed files with 131 additions and 35 deletions
|
|
@ -114,6 +114,61 @@ a:hover { color: var(--gold-hover); text-decoration: underline; }
|
|||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* Unbeschrifteter Trenner zwischen "Dashboard/Mein Profil/Mitglieder" und
|
||||
"Raids/Premades" - optisch etwas getrennter, aber ohne eigene Ueberschrift
|
||||
wie beim Admin-Bereich. */
|
||||
.sidebar-nav-gap {
|
||||
height: 0;
|
||||
margin-top: 0.6rem;
|
||||
padding-top: 0.6rem;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
/* Mobile Kopfleiste mit Burger-Button: ersetzt auf schmalen Bildschirmen die
|
||||
Sidebar, die dort stattdessen als ausklappbare Schublade (siehe unten)
|
||||
fungiert. Auf Desktop-Breiten bleibt sie unsichtbar. */
|
||||
.mobile-topbar {
|
||||
display: none;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.6rem 1rem;
|
||||
background: var(--bg-panel);
|
||||
border-bottom: 1px solid var(--border);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 900;
|
||||
}
|
||||
|
||||
.mobile-topbar-brand img {
|
||||
display: block;
|
||||
height: 32px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.sidebar-toggle {
|
||||
display: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
flex-shrink: 0;
|
||||
background: var(--bg-panel-alt);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sidebar-toggle:hover { border-color: var(--gold); color: var(--gold); background: var(--bg-panel-alt); }
|
||||
|
||||
.sidebar-backdrop {
|
||||
display: none;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.sidebar-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
@ -625,41 +680,31 @@ input:focus, select:focus, textarea:focus {
|
|||
min-height: 0;
|
||||
}
|
||||
|
||||
/* Die Sidebar selbst wird auf schmalen Bildschirmen zur ausklappbaren
|
||||
Schublade: per Default ausserhalb des Viewports (transform), das
|
||||
".open"-Klasse (via assets/js/nav.js) schiebt sie rein. Sie behaelt
|
||||
dabei exakt die gleiche Optik/Beschriftung wie am Desktop. */
|
||||
.mobile-topbar { display: flex; }
|
||||
.sidebar-toggle { display: inline-flex; }
|
||||
|
||||
.sidebar {
|
||||
position: static;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.6rem 0.75rem;
|
||||
overflow-x: auto;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: min(280px, 82vw);
|
||||
height: 100vh;
|
||||
transform: translateX(-100%);
|
||||
transition: transform 0.25s ease;
|
||||
z-index: 1000;
|
||||
padding: 1.25rem 1rem;
|
||||
}
|
||||
|
||||
.sidebar-brand { padding: 0 0.75rem 0 0; }
|
||||
.sidebar-brand img { height: 32px; }
|
||||
|
||||
.sidebar-nav {
|
||||
flex-direction: row;
|
||||
flex: none;
|
||||
.sidebar.open {
|
||||
transform: translateX(0);
|
||||
box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
.sidebar-section-label { display: none; }
|
||||
|
||||
.sidebar-link .label { display: none; }
|
||||
|
||||
.sidebar-footer {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin-top: 0;
|
||||
margin-left: auto;
|
||||
padding-top: 0;
|
||||
padding-left: 0.75rem;
|
||||
border-top: none;
|
||||
border-left: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.sidebar-user { display: none; }
|
||||
.sidebar-backdrop.open { display: block; }
|
||||
}
|
||||
|
||||
/* --- Raid-Verwaltung: Icon-Buttons, Editor-Modus, Modal, Drag & Drop --- */
|
||||
|
|
|
|||
38
assets/js/nav.js
Normal file
38
assets/js/nav.js
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
(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();
|
||||
});
|
||||
})();
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
</main>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/js/nav.js"></script>
|
||||
<?php else: ?>
|
||||
</main>
|
||||
<?php endif; ?>
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ function icon(string $name): string
|
|||
'restore' => '<polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/>',
|
||||
'trash' => '<polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/>',
|
||||
'crown' => '<path d="M4 8l4 3 4-6 4 6 4-3-2 9H6z"/><path d="M6 20h12"/>',
|
||||
'menu' => '<line x1="4" y1="7" x2="20" y2="7"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="17" x2="20" y2="17"/>',
|
||||
];
|
||||
|
||||
$path = $paths[$name] ?? '';
|
||||
|
|
|
|||
|
|
@ -50,6 +50,13 @@ $pageBackgroundClass = $pageBackgrounds[$currentScript] ?? '';
|
|||
<body>
|
||||
<?php if ($currentUser): ?>
|
||||
<div class="app-shell">
|
||||
<div class="mobile-topbar">
|
||||
<button type="button" class="sidebar-toggle" aria-label="Menü öffnen" aria-expanded="false">
|
||||
<?= icon('menu') ?>
|
||||
</button>
|
||||
<a href="/" class="mobile-topbar-brand"><img src="/assets/images/logo-mark.svg" alt="Aion2 Gilde"></a>
|
||||
</div>
|
||||
<div class="sidebar-backdrop"></div>
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-brand"><a href="/"><img src="/assets/images/logo-mark.svg" alt="Aion2 Gilde"></a></div>
|
||||
<nav class="sidebar-nav">
|
||||
|
|
@ -59,6 +66,15 @@ $pageBackgroundClass = $pageBackgrounds[$currentScript] ?? '';
|
|||
<a href="/profile.php" class="sidebar-link<?= $isProfileActive ? ' active' : '' ?>" title="Mein Profil">
|
||||
<?= icon('profile') ?><span class="label">Mein Profil</span>
|
||||
</a>
|
||||
<?php if ($canViewMembers): ?>
|
||||
<a href="/members.php" class="sidebar-link<?= $isMembersActive ? ' active' : '' ?>" title="Mitglieder">
|
||||
<?= icon('users') ?><span class="label">Mitglieder</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($canViewRaids || $canViewPremades): ?>
|
||||
<div class="sidebar-nav-gap"></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($canViewRaids): ?>
|
||||
<a href="/raids.php" class="sidebar-link<?= $isRaidsActive ? ' active' : '' ?>" title="Raids">
|
||||
<?= icon('calendar') ?><span class="label">Raids</span>
|
||||
|
|
@ -69,11 +85,6 @@ $pageBackgroundClass = $pageBackgrounds[$currentScript] ?? '';
|
|||
<?= icon('shield') ?><span class="label">Premades</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($canViewMembers): ?>
|
||||
<a href="/members.php" class="sidebar-link<?= $isMembersActive ? ' active' : '' ?>" title="Mitglieder">
|
||||
<?= icon('users') ?><span class="label">Mitglieder</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($showAdminMenu): ?>
|
||||
<div class="sidebar-section-label">Admin</div>
|
||||
<?php if ($canViewUsers): ?>
|
||||
|
|
|
|||
Loading…
Reference in a new issue