feat: sistema de design (tokens claro/escuro) + sidebar responsiva em base.html
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
7656f2261e
commit
310f5e1f71
@@ -0,0 +1,39 @@
|
||||
// app/static/sidebar.js — abre/fecha a gaveta da sidebar no mobile e
|
||||
// recolhe/expande no desktop, persistindo a preferência de recolher.
|
||||
(function () {
|
||||
var sidebar = document.getElementById("sidebar");
|
||||
var backdrop = document.getElementById("sidebar-backdrop");
|
||||
var btnMenuMobile = document.getElementById("btn-menu-mobile");
|
||||
var btnRecolher = document.getElementById("botao-recolher");
|
||||
if (!sidebar) return;
|
||||
|
||||
function abrirGaveta() {
|
||||
sidebar.classList.add("aberta");
|
||||
if (backdrop) backdrop.classList.add("aberta");
|
||||
}
|
||||
function fecharGaveta() {
|
||||
sidebar.classList.remove("aberta");
|
||||
if (backdrop) backdrop.classList.remove("aberta");
|
||||
}
|
||||
|
||||
if (btnMenuMobile) {
|
||||
btnMenuMobile.addEventListener("click", function () {
|
||||
if (sidebar.classList.contains("aberta")) fecharGaveta();
|
||||
else abrirGaveta();
|
||||
});
|
||||
}
|
||||
if (backdrop) backdrop.addEventListener("click", fecharGaveta);
|
||||
sidebar.querySelectorAll("a").forEach(function (link) {
|
||||
link.addEventListener("click", fecharGaveta);
|
||||
});
|
||||
|
||||
if (btnRecolher) {
|
||||
if (localStorage.getItem("sidebarRecolhida") === "1") {
|
||||
sidebar.classList.add("recolhida");
|
||||
}
|
||||
btnRecolher.addEventListener("click", function () {
|
||||
var recolhida = sidebar.classList.toggle("recolhida");
|
||||
localStorage.setItem("sidebarRecolhida", recolhida ? "1" : "0");
|
||||
});
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user