fix(sidebar): centrar labels (styles.css tenía mayor especificidad), preservar scroll al toggle
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
3a66576ff8
commit
18051a4f31
+11
-7
@@ -150,7 +150,7 @@ body {
|
||||
/* ── Etiquetas de categoría ───────────────────────────── */
|
||||
.sidebar-menu li.sidebar-section {
|
||||
border-bottom: none;
|
||||
padding: 10px 16px 6px;
|
||||
padding: 10px 30px 6px;
|
||||
font-size: 0.65rem;
|
||||
font-weight: 800;
|
||||
text-transform: uppercase;
|
||||
@@ -158,18 +158,22 @@ body {
|
||||
color: rgba(255, 255, 255, 0.55);
|
||||
pointer-events: auto;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 5px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
border-radius: 6px;
|
||||
border-left: 3px solid transparent;
|
||||
margin: 4px 8px 0;
|
||||
transition: background .15s, color .15s;
|
||||
transition: background .15s, color .15s, border-color .15s;
|
||||
}
|
||||
.sidebar-menu li.sidebar-section:hover { color: rgba(255,255,255,.9); background: rgba(255,255,255,.07); }
|
||||
.sidebar-menu li.sidebar-section .sb-cat-label { display:flex; align-items:center; gap:4px; }
|
||||
.sidebar-menu li.sidebar-section.has-active {
|
||||
border-left-color: rgba(255,255,255,.7);
|
||||
background: rgba(255,255,255,.1);
|
||||
color: #fff;
|
||||
}
|
||||
.sidebar-menu li.sidebar-section .sb-cat-label { display:inline-flex; align-items:center; gap:4px; }
|
||||
.sidebar-menu li.sidebar-section::after { display: none; }
|
||||
|
||||
/* ── Badge dentro de un item ──────────────────────────── */
|
||||
|
||||
@@ -159,7 +159,7 @@ if (class_exists('ModuleRegistry', false)) {
|
||||
?>
|
||||
<li class="sidebar-section<?= $_catHasActive ? ' has-active' : '' ?>"
|
||||
data-cat="<?= $catId ?>"
|
||||
onclick="sbToggleCat('<?= $catId ?>', this)">
|
||||
onclick="sbToggleCat('<?= $catId ?>',this,event)">
|
||||
<span class="sb-cat-label">
|
||||
<i class="<?= htmlspecialchars($catData['icon'], ENT_QUOTES, 'UTF-8') ?> me-1"></i>
|
||||
<?= htmlspecialchars($catData['label'], ENT_QUOTES, 'UTF-8') ?>
|
||||
@@ -380,7 +380,11 @@ if (class_exists('ModuleRegistry', false)) {
|
||||
}
|
||||
}
|
||||
|
||||
window.sbToggleCat = function(catId, sectionEl) {
|
||||
window.sbToggleCat = function(catId, sectionEl, ev) {
|
||||
if (ev) { ev.preventDefault(); ev.stopPropagation(); }
|
||||
var nav = document.getElementById('erp-sidebar');
|
||||
var savedScroll = nav ? nav.scrollTop : 0;
|
||||
|
||||
var group = document.getElementById(catId);
|
||||
if (!group) return;
|
||||
var isCollapsed = group.classList.contains('collapsed');
|
||||
@@ -400,6 +404,9 @@ if (class_exists('ModuleRegistry', false)) {
|
||||
});
|
||||
}
|
||||
setCollapsed(arr);
|
||||
|
||||
// Restaurar scroll del sidebar para que no salte al top
|
||||
if (nav) { requestAnimationFrame(function(){ nav.scrollTop = savedScroll; }); }
|
||||
};
|
||||
|
||||
// ── Buscador de menú ─────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user