feat(nav): refonte du layout — barre latérale repliable, topbar mince (issue #16)
Retour de Bruno sur la 0.15.0 (disposition pas conviviale, trop de place, mobile inchangé): la barre horizontale disparaît. Barre latérale groupée (Principal/Rituels/Pilotage/Outils), repliable en rail d'icônes mémorisé sur desktop, tiroir hors-canvas sur mobile; topbar de 52px (fil d'Ariane + actions).
This commit is contained in:
+76
-54
@@ -1,63 +1,85 @@
|
||||
{# ── Header global partagé (issue #16) ─────────────────────────────
|
||||
NE PAS dupliquer ce markup dans les pages : c'est l'unique source.
|
||||
Page active : variable `active_nav` (déduite du gabarit dans
|
||||
render(), app/main.py). Fil d'Ariane projet : `owner`+`repo`
|
||||
(board) ou `full_name` (pages projet). Lien Gitea externe si
|
||||
`repo_info.html_url` est présent (board).
|
||||
Desktop : primaires + menu « Plus ▾ ». Mobile : burger + panneau.
|
||||
{# ── Cadre applicatif partagé (issue #16, refonte 0.16.0) ─────────
|
||||
Barre latérale unique pour TOUTES les pages applicatives :
|
||||
desktop = barre fixe repliable en rail d'icônes (état mémorisé),
|
||||
mobile = tiroir hors-canvas ouvert par le burger de la topbar.
|
||||
NE PAS dupliquer ce markup dans les pages.
|
||||
Page active : `active_nav` (déduite du gabarit dans render()).
|
||||
Fil d'Ariane : `owner`+`repo` (board) ou `full_name` (projet).
|
||||
Le wallboard (TV) n'inclut pas ce partiel, volontairement. #}
|
||||
<header class="app-header">
|
||||
<div class="brand">
|
||||
<a href="/" class="logo" aria-label="Kanbante — accueil"><span class="logo-mark">📋</span><span class="gradient-text">Kanbante</span></a>
|
||||
{% if owner is defined and repo is defined %}
|
||||
<span class="crumb"><span class="sep">/</span> <a href="/board/{{ owner }}/{{ repo }}">{{ owner }} / <strong>{{ repo }}</strong></a></span>
|
||||
{% elif full_name is defined %}
|
||||
<span class="crumb"><span class="sep">/</span> <a href="/board/{{ full_name }}">{{ full_name }}</a></span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<nav class="nav-pills main-nav" aria-label="Navigation principale">
|
||||
<a href="/" class="nav-pill{% if active_nav == 'home' %} active{% endif %}">🏠 Projets</a>
|
||||
<a href="/focus" class="nav-pill{% if active_nav == 'focus' %} active{% endif %}">🎯 Focus</a>
|
||||
<a href="/today" class="nav-pill{% if active_nav == 'today' %} active{% endif %}">🌅 Aujourd'hui</a>
|
||||
<a href="/search" class="nav-pill{% if active_nav == 'search' %} active{% endif %}">🔍 Recherche</a>
|
||||
<a href="/capture" class="nav-pill{% if active_nav == 'capture' %} active{% endif %}">⚡ Capture</a>
|
||||
<div class="nav-more">
|
||||
<button type="button" class="nav-pill nav-more-btn{% if active_nav in ['my', 'activity', 'briefing', 'standup', 'digest', 'forecast', 'rules', 'health'] %} active-soft{% endif %}" id="nav-more-btn" aria-expanded="false" aria-controls="nav-more-menu">Plus <span aria-hidden="true">▾</span></button>
|
||||
<div class="nav-more-menu" id="nav-more-menu" role="menu" hidden>
|
||||
<a href="/my" class="nav-pill{% if active_nav == 'my' %} active{% endif %}" role="menuitem">👤 Mes issues</a>
|
||||
<a href="/activity" class="nav-pill{% if active_nav == 'activity' %} active{% endif %}" role="menuitem">📰 Activité</a>
|
||||
<a href="/briefing" class="nav-pill{% if active_nav == 'briefing' %} active{% endif %}" role="menuitem">📊 Briefing</a>
|
||||
<a href="/standup" class="nav-pill{% if active_nav == 'standup' %} active{% endif %}" role="menuitem">🗣️ Standup</a>
|
||||
<a href="/digest" class="nav-pill{% if active_nav == 'digest' %} active{% endif %}" role="menuitem">🧠 Digest</a>
|
||||
<a href="/forecast" class="nav-pill{% if active_nav == 'forecast' %} active{% endif %}" role="menuitem">🔮 Prévisions</a>
|
||||
<a href="/rules" class="nav-pill{% if active_nav == 'rules' %} active{% endif %}" role="menuitem">⚙️ Règles</a>
|
||||
<a href="/health" class="nav-pill{% if active_nav == 'health' %} active{% endif %}" role="menuitem">🩺 Santé</a>
|
||||
<a href="/wall" class="nav-pill" role="menuitem">🖥️ Wallboard</a>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.body.classList.add('with-sidebar');
|
||||
try {
|
||||
if (localStorage.getItem('kanbante-sidebar') === 'collapsed') {
|
||||
document.body.classList.add('sidebar-collapsed');
|
||||
}
|
||||
} catch (e) { /* stockage indisponible : état par défaut */ }
|
||||
</script>
|
||||
{% set nav_groups = [
|
||||
("Principal", [
|
||||
("home", "/", "🏠", "Projets"),
|
||||
("focus", "/focus", "🎯", "Focus"),
|
||||
("today", "/today", "🌅", "Aujourd'hui"),
|
||||
("my", "/my", "👤", "Mes issues"),
|
||||
]),
|
||||
("Rituels", [
|
||||
("briefing", "/briefing", "📊", "Briefing"),
|
||||
("standup", "/standup", "🗣️", "Standup"),
|
||||
("digest", "/digest", "🧠", "Digest"),
|
||||
]),
|
||||
("Pilotage", [
|
||||
("forecast", "/forecast", "🔮", "Prévisions"),
|
||||
("health", "/health", "🩺", "Santé"),
|
||||
("rules", "/rules", "⚙️", "Règles"),
|
||||
("activity", "/activity", "📰", "Activité"),
|
||||
]),
|
||||
("Outils", [
|
||||
("search", "/search", "🔍", "Recherche"),
|
||||
("capture", "/capture", "⚡", "Capture"),
|
||||
("wall", "/wall", "🖥️", "Wallboard"),
|
||||
]),
|
||||
] %}
|
||||
<aside class="sidebar" id="sidebar" aria-label="Navigation principale">
|
||||
<a href="/" class="side-logo" aria-label="Kanbante — accueil">
|
||||
<span class="logo-mark">📋</span>
|
||||
<span class="side-label gradient-text">Kanbante</span>
|
||||
</a>
|
||||
<button type="button" class="side-search palette-trigger" title="Palette de commandes (Ctrl+K)">
|
||||
<span class="side-ico">⌨️</span>
|
||||
<span class="side-label">Recherche & commandes</span>
|
||||
<kbd class="side-label">Ctrl K</kbd>
|
||||
</button>
|
||||
<nav class="side-nav">
|
||||
{% for group, links in nav_groups %}
|
||||
<div class="side-group">{{ group }}</div>
|
||||
{% for key, href, icon, label in links %}
|
||||
<a href="{{ href }}" class="side-link{% if active_nav == key %} active{% endif %}" title="{{ label }}">
|
||||
<span class="side-ico">{{ icon }}</span>
|
||||
<span class="side-label">{{ label }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</nav>
|
||||
<div class="side-foot">
|
||||
<button type="button" class="side-collapse" id="side-collapse" aria-label="Replier ou déplier le menu">
|
||||
<span class="side-collapse-ico">«</span>
|
||||
<span class="side-label">Replier</span>
|
||||
</button>
|
||||
<span class="side-version side-label">v{{ version }}</span>
|
||||
</div>
|
||||
</aside>
|
||||
<div class="side-backdrop" id="side-backdrop" hidden></div>
|
||||
<header class="app-header topbar">
|
||||
<button type="button" class="nav-burger" id="nav-burger" aria-expanded="false" aria-controls="sidebar" aria-label="Ouvrir le menu">☰</button>
|
||||
{% if owner is defined and repo is defined %}
|
||||
<span class="crumb"><a href="/board/{{ owner }}/{{ repo }}">{{ owner }} / <strong>{{ repo }}</strong></a></span>
|
||||
{% elif full_name is defined %}
|
||||
<span class="crumb"><a href="/board/{{ full_name }}">{{ full_name }}</a></span>
|
||||
{% endif %}
|
||||
<div class="header-actions">
|
||||
{% if repo_info is defined and repo_info and repo_info.html_url %}
|
||||
<a href="{{ repo_info.html_url }}" target="_blank" rel="noopener" class="nav-pill" title="Ouvrir ce dépôt dans Gitea">🔗 Gitea ↗</a>
|
||||
{% endif %}
|
||||
<button type="button" class="nav-pill palette-trigger" title="Palette de commandes (Ctrl+K)">⌨️ Ctrl K</button>
|
||||
<button type="button" class="nav-burger" id="nav-burger" aria-expanded="false" aria-controls="mobile-nav" aria-label="Ouvrir le menu">☰</button>
|
||||
<button type="button" class="nav-pill palette-trigger topbar-search" title="Recherche et commandes (Ctrl+K)">🔍</button>
|
||||
</div>
|
||||
<nav class="mobile-nav" id="mobile-nav" aria-label="Menu mobile" hidden>
|
||||
<a href="/" class="{% if active_nav == 'home' %}active{% endif %}">🏠 Projets</a>
|
||||
<a href="/focus" class="{% if active_nav == 'focus' %}active{% endif %}">🎯 Focus</a>
|
||||
<a href="/today" class="{% if active_nav == 'today' %}active{% endif %}">🌅 Aujourd'hui</a>
|
||||
<a href="/search" class="{% if active_nav == 'search' %}active{% endif %}">🔍 Recherche</a>
|
||||
<a href="/capture" class="{% if active_nav == 'capture' %}active{% endif %}">⚡ Capture</a>
|
||||
<a href="/my" class="{% if active_nav == 'my' %}active{% endif %}">👤 Mes issues</a>
|
||||
<a href="/activity" class="{% if active_nav == 'activity' %}active{% endif %}">📰 Activité</a>
|
||||
<a href="/briefing" class="{% if active_nav == 'briefing' %}active{% endif %}">📊 Briefing</a>
|
||||
<a href="/standup" class="{% if active_nav == 'standup' %}active{% endif %}">🗣️ Standup</a>
|
||||
<a href="/digest" class="{% if active_nav == 'digest' %}active{% endif %}">🧠 Digest</a>
|
||||
<a href="/forecast" class="{% if active_nav == 'forecast' %}active{% endif %}">🔮 Prévisions</a>
|
||||
<a href="/rules" class="{% if active_nav == 'rules' %}active{% endif %}">⚙️ Règles</a>
|
||||
<a href="/health" class="{% if active_nav == 'health' %}active{% endif %}">🩺 Santé</a>
|
||||
<a href="/wall">🖥️ Wallboard</a>
|
||||
</nav>
|
||||
<script src="/static/js/nav.js" defer></script>
|
||||
</header>
|
||||
|
||||
+109
-35
@@ -900,15 +900,21 @@ footer {
|
||||
color: #e5ecf5;
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
overflow: hidden;
|
||||
}
|
||||
.wall-stage { position: relative; min-height: 100vh; }
|
||||
.wall-stage { position: relative; height: 100vh; height: 100dvh; }
|
||||
.wall-slide {
|
||||
display: none;
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
max-height: 100dvh;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding: 4vh 4vw;
|
||||
padding: 3.5vh 4vw 96px;
|
||||
flex-direction: column;
|
||||
gap: 3vh;
|
||||
gap: 2.5vh;
|
||||
}
|
||||
.wall-slide.active { display: flex; animation: wall-in 0.45s ease; }
|
||||
@keyframes wall-in { from { opacity: 0; } to { opacity: 1; } }
|
||||
@@ -934,7 +940,14 @@ footer {
|
||||
}
|
||||
.wall-count-n { display: block; font-size: clamp(1.9rem, 3.6vw, 3rem); font-weight: 800; }
|
||||
.wall-count-l { display: block; color: #aebdd2; font-size: clamp(0.78rem, 1.25vw, 1.02rem); margin-top: 2px; }
|
||||
.wall-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
|
||||
.wall-cards {
|
||||
list-style: none; margin: 0; padding: 0;
|
||||
display: flex; flex-direction: column; gap: 12px;
|
||||
flex: 1 1 auto; min-height: 0; overflow: hidden;
|
||||
-webkit-mask-image: linear-gradient(to bottom, #000 88%, transparent);
|
||||
mask-image: linear-gradient(to bottom, #000 88%, transparent);
|
||||
}
|
||||
.wall-more { justify-content: center; color: #8fa3bf; font-size: 1.1rem; background: transparent; }
|
||||
.wall-card {
|
||||
display: flex; align-items: center; gap: 18px;
|
||||
background: rgba(255, 255, 255, 0.045);
|
||||
@@ -954,8 +967,17 @@ footer {
|
||||
.wall-foot {
|
||||
margin-top: auto;
|
||||
display: flex; gap: 36px; flex-wrap: wrap;
|
||||
justify-content: space-between; align-items: center;
|
||||
width: 100%; box-sizing: border-box;
|
||||
font-size: clamp(1rem, 1.7vw, 1.35rem); color: #aebdd2;
|
||||
}
|
||||
@media (max-height: 760px) {
|
||||
.wall-slide { gap: 1.6vh; padding-top: 2.5vh; }
|
||||
.wall-card { padding: 10px 16px; }
|
||||
.wall-count { padding: 8px 8px 7px; }
|
||||
.wall-project { font-size: clamp(1.8rem, 4vw, 2.6rem); }
|
||||
.wall-time { font-size: clamp(1.7rem, 3.6vw, 2.6rem); }
|
||||
}
|
||||
.wall-live { color: #34d399; font-weight: 700; letter-spacing: 0.08em; }
|
||||
.wall-empty {
|
||||
min-height: 100vh; display: flex; flex-direction: column;
|
||||
@@ -1166,46 +1188,98 @@ footer {
|
||||
.zombie-actions { display: flex; gap: 6px; flex-shrink: 0; }
|
||||
|
||||
/* ── Header unifié (0.15.0, #16) ── */
|
||||
.main-nav { flex-wrap: nowrap; }
|
||||
.header-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }
|
||||
.nav-more { position: relative; }
|
||||
.nav-more-btn { background: transparent; cursor: pointer; }
|
||||
.nav-more-btn.active-soft { color: var(--text); border-color: var(--accent, #58a6ff); }
|
||||
.nav-more-menu {
|
||||
position: absolute; right: 0; top: calc(100% + 8px); z-index: 120;
|
||||
min-width: 232px; display: flex; flex-direction: column; gap: 2px;
|
||||
background: var(--surface-1, #131a29); border: 1px solid var(--border);
|
||||
border-radius: 12px; padding: 6px;
|
||||
box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
.nav-more-menu .nav-pill { display: flex; border-radius: 8px; }
|
||||
.nav-more-menu[hidden], .mobile-nav[hidden] { display: none !important; }
|
||||
.nav-burger {
|
||||
display: none; width: 40px; height: 40px; border-radius: 10px;
|
||||
background: var(--surface-2); border: 1px solid var(--border);
|
||||
color: var(--text); font-size: 1.05rem; cursor: pointer;
|
||||
align-items: center; justify-content: center;
|
||||
}
|
||||
.mobile-nav {
|
||||
position: absolute; top: 100%; left: 0; right: 0; z-index: 110;
|
||||
display: flex; flex-direction: column; gap: 2px;
|
||||
background: rgba(16, 19, 28, 0.97); backdrop-filter: blur(14px);
|
||||
border-bottom: 1px solid var(--border); padding: 10px 14px 16px;
|
||||
}
|
||||
.mobile-nav a {
|
||||
display: flex; align-items: center; min-height: 44px;
|
||||
padding: 10px 12px; border-radius: 10px;
|
||||
color: var(--text-2); font-size: 1rem; text-decoration: none;
|
||||
}
|
||||
.mobile-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
|
||||
.mobile-nav a.active {
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, rgba(124,92,252,.85), rgba(91,138,247,.85));
|
||||
}
|
||||
.crumb a { color: inherit; text-decoration: none; }
|
||||
.crumb a:hover { text-decoration: underline; }
|
||||
@media (max-width: 900px) {
|
||||
.main-nav { display: none; }
|
||||
.nav-burger { display: inline-flex; }
|
||||
.crumb { display: none; }
|
||||
}
|
||||
|
||||
/* ── Barre latérale (0.16.0, #16 refonte) ── */
|
||||
body.with-sidebar { padding-left: 238px; transition: padding-left 0.18s ease; }
|
||||
body.with-sidebar.sidebar-collapsed { padding-left: 68px; }
|
||||
.sidebar {
|
||||
position: fixed; left: 0; top: 0; bottom: 0; z-index: 200;
|
||||
width: 238px; box-sizing: border-box;
|
||||
display: flex; flex-direction: column; gap: 6px;
|
||||
padding: 16px 12px 12px; overflow-y: auto; overflow-x: hidden;
|
||||
background: rgba(13, 16, 24, 0.96); backdrop-filter: blur(14px);
|
||||
border-right: 1px solid var(--border);
|
||||
transition: width 0.18s ease, transform 0.22s ease;
|
||||
}
|
||||
body.sidebar-collapsed .sidebar { width: 68px; }
|
||||
.side-logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; color: var(--text); font-size: 1.18rem; font-weight: 700; white-space: nowrap; }
|
||||
.side-logo:hover { text-decoration: none; }
|
||||
.side-search {
|
||||
display: flex; align-items: center; gap: 10px; width: 100%;
|
||||
padding: 9px 10px; margin-bottom: 8px; cursor: pointer;
|
||||
background: var(--surface-2); color: var(--text-2);
|
||||
border: 1px solid var(--border); border-radius: 10px; font-size: 0.9rem;
|
||||
white-space: nowrap; overflow: hidden;
|
||||
}
|
||||
.side-search:hover { color: var(--text); border-color: var(--accent, #58a6ff); }
|
||||
.side-search kbd {
|
||||
margin-left: auto; font-size: 0.72rem; background: var(--surface-3, #1d2942);
|
||||
border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px;
|
||||
}
|
||||
.side-nav { display: flex; flex-direction: column; gap: 2px; }
|
||||
.side-group {
|
||||
margin: 14px 10px 5px; font-size: 0.7rem; font-weight: 700;
|
||||
letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.side-link {
|
||||
display: flex; align-items: center; gap: 11px;
|
||||
padding: 8px 10px; border-radius: 9px;
|
||||
color: var(--text-2); font-size: 0.95rem; font-weight: 500;
|
||||
white-space: nowrap; border-left: 3px solid transparent;
|
||||
}
|
||||
.side-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
|
||||
.side-link.active {
|
||||
color: #fff; border-left-color: #a78bfa;
|
||||
background: linear-gradient(90deg, rgba(124,92,252,.32), rgba(91,138,247,.14));
|
||||
}
|
||||
.side-ico { font-size: 1.05rem; width: 22px; text-align: center; flex-shrink: 0; }
|
||||
.side-foot {
|
||||
margin-top: auto; padding-top: 12px;
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
||||
}
|
||||
.side-collapse {
|
||||
display: flex; align-items: center; gap: 8px; cursor: pointer;
|
||||
background: transparent; border: 1px solid var(--border); border-radius: 9px;
|
||||
color: var(--text-2); padding: 6px 10px; font-size: 0.85rem; white-space: nowrap;
|
||||
}
|
||||
.side-collapse:hover { color: var(--text); }
|
||||
.side-collapse-ico { display: inline-block; transition: transform 0.18s ease; }
|
||||
body.sidebar-collapsed .side-collapse-ico { transform: rotate(180deg); }
|
||||
.side-version { color: var(--text-3); font-size: 0.8rem; }
|
||||
body.sidebar-collapsed .side-label,
|
||||
body.sidebar-collapsed .side-group { display: none; }
|
||||
body.sidebar-collapsed .side-link,
|
||||
body.sidebar-collapsed .side-search { justify-content: center; padding-left: 0; padding-right: 0; }
|
||||
body.sidebar-collapsed .side-logo { justify-content: center; padding-left: 0; padding-right: 0; }
|
||||
body.sidebar-collapsed .side-foot { justify-content: center; }
|
||||
.side-backdrop {
|
||||
position: fixed; inset: 0; z-index: 190;
|
||||
background: rgba(4, 6, 10, 0.55);
|
||||
}
|
||||
.topbar { min-height: 52px; padding: 8px 18px; justify-content: flex-start; gap: 14px; }
|
||||
.topbar-search { display: none; }
|
||||
@media (max-width: 900px) {
|
||||
body.with-sidebar, body.with-sidebar.sidebar-collapsed { padding-left: 0; }
|
||||
.sidebar { width: 264px; transform: translateX(-105%); box-shadow: none; }
|
||||
body.sidebar-open .sidebar { transform: none; box-shadow: 18px 0 44px rgba(0,0,0,.5); }
|
||||
body.sidebar-collapsed .side-label,
|
||||
body.sidebar-collapsed .side-group { display: initial; }
|
||||
body.sidebar-collapsed .side-link,
|
||||
body.sidebar-collapsed .side-search { justify-content: flex-start; padding-left: 10px; padding-right: 10px; }
|
||||
.side-foot { display: none; }
|
||||
.topbar-search { display: inline-flex; }
|
||||
}
|
||||
|
||||
+28
-38
@@ -1,55 +1,45 @@
|
||||
/**
|
||||
* Kanbante — header navigation (issue #16): the "Plus" dropdown on
|
||||
* desktop and the burger panel on mobile. One shared partial
|
||||
* (_header.html), one shared behaviour: this file.
|
||||
* Kanbante — sidebar behaviour (issue #16, 0.16.0 layout).
|
||||
* Desktop: collapse to an icon rail (persisted in localStorage).
|
||||
* Mobile: the same sidebar becomes an off-canvas drawer, toggled
|
||||
* by the topbar burger, closed by backdrop / Escape / navigation.
|
||||
*/
|
||||
(function () {
|
||||
var moreBtn = document.getElementById('nav-more-btn');
|
||||
var moreMenu = document.getElementById('nav-more-menu');
|
||||
var burger = document.getElementById('nav-burger');
|
||||
var mobileNav = document.getElementById('mobile-nav');
|
||||
var backdrop = document.getElementById('side-backdrop');
|
||||
var collapseBtn = document.getElementById('side-collapse');
|
||||
|
||||
function setOpen(menu, btn, open) {
|
||||
if (!menu || !btn) return;
|
||||
menu.hidden = !open;
|
||||
btn.setAttribute('aria-expanded', open ? 'true' : 'false');
|
||||
}
|
||||
function closeAll() {
|
||||
setOpen(moreMenu, moreBtn, false);
|
||||
setOpen(mobileNav, burger, false);
|
||||
function closeDrawer() {
|
||||
document.body.classList.remove('sidebar-open');
|
||||
if (backdrop) backdrop.hidden = true;
|
||||
if (burger) {
|
||||
burger.setAttribute('aria-expanded', 'false');
|
||||
burger.textContent = '☰';
|
||||
burger.setAttribute('aria-label', 'Ouvrir le menu');
|
||||
}
|
||||
}
|
||||
|
||||
if (moreBtn && moreMenu) {
|
||||
moreBtn.addEventListener('click', function (e) {
|
||||
e.stopPropagation();
|
||||
var willOpen = moreMenu.hidden;
|
||||
closeAll();
|
||||
setOpen(moreMenu, moreBtn, willOpen);
|
||||
});
|
||||
moreMenu.addEventListener('click', function (e) { e.stopPropagation(); });
|
||||
}
|
||||
if (burger && mobileNav) {
|
||||
burger.addEventListener('click', function (e) {
|
||||
e.stopPropagation();
|
||||
var willOpen = mobileNav.hidden;
|
||||
closeAll();
|
||||
setOpen(mobileNav, burger, willOpen);
|
||||
burger.textContent = willOpen ? '✕' : '☰';
|
||||
burger.setAttribute('aria-label', willOpen ? 'Fermer le menu' : 'Ouvrir le menu');
|
||||
if (burger) {
|
||||
burger.addEventListener('click', function () {
|
||||
var open = document.body.classList.toggle('sidebar-open');
|
||||
burger.setAttribute('aria-expanded', open ? 'true' : 'false');
|
||||
burger.textContent = open ? '✕' : '☰';
|
||||
if (backdrop) backdrop.hidden = !open;
|
||||
});
|
||||
}
|
||||
document.addEventListener('click', function () { closeAll(); });
|
||||
if (backdrop) backdrop.addEventListener('click', closeDrawer);
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Escape') closeAll();
|
||||
if (e.key === 'Escape') closeDrawer();
|
||||
});
|
||||
window.addEventListener('resize', function () {
|
||||
if (window.innerWidth > 900) {
|
||||
closeAll();
|
||||
if (burger) burger.textContent = '☰';
|
||||
}
|
||||
if (window.innerWidth > 900) closeDrawer();
|
||||
});
|
||||
|
||||
if (collapseBtn) {
|
||||
collapseBtn.addEventListener('click', function () {
|
||||
var collapsed = document.body.classList.toggle('sidebar-collapsed');
|
||||
try {
|
||||
localStorage.setItem('kanbante-sidebar', collapsed ? 'collapsed' : 'open');
|
||||
} catch (e) { /* private mode: state lasts for the page only */ }
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user