feat(sidebar): color por categoría via CSS custom property --cat-color
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
e90cfda3f3
commit
92e4d01181
@@ -135,6 +135,16 @@ $_base = defined('APP_URL') ? rtrim(APP_URL, '/') : '';
|
||||
<ul class="sidebar-menu" id="sb-menu">
|
||||
|
||||
<?php
|
||||
// ── Paleta de colores por categoría ────────────────────────────────────────
|
||||
$_catPalette = [
|
||||
'lab' => '#60a5fa',
|
||||
'bot' => '#4ade80',
|
||||
'turnero' => '#fbbf24',
|
||||
'clinico' => '#c084fc',
|
||||
'formularios' => '#22d3ee',
|
||||
'sistema' => '#94a3b8',
|
||||
];
|
||||
|
||||
// ── Renderizado dinámico desde ModuleRegistry ───────────────────────────────
|
||||
if (class_exists('ModuleRegistry', false)) {
|
||||
$sidebarGroups = ModuleRegistry::forSidebar();
|
||||
@@ -155,10 +165,12 @@ if (class_exists('ModuleRegistry', false)) {
|
||||
if ($__route && $_isActive($__route) !== '') { $_catHasActive = true; break; }
|
||||
}
|
||||
}
|
||||
$catId = 'sb-cat-' . htmlspecialchars($catKey, ENT_QUOTES, 'UTF-8');
|
||||
$catId = 'sb-cat-' . htmlspecialchars($catKey, ENT_QUOTES, 'UTF-8');
|
||||
$_catColor = $_catPalette[$catKey] ?? '#94a3b8';
|
||||
?>
|
||||
<li class="sidebar-section<?= $_catHasActive ? ' has-active' : '' ?>"
|
||||
data-cat="<?= $catId ?>"
|
||||
style="--cat-color:<?= $_catColor ?>"
|
||||
onclick="sbToggleCat('<?= $catId ?>',this,event)">
|
||||
<span class="sb-cat-label">
|
||||
<i class="<?= htmlspecialchars($catData['icon'], ENT_QUOTES, 'UTF-8') ?> me-1"></i>
|
||||
@@ -166,7 +178,7 @@ if (class_exists('ModuleRegistry', false)) {
|
||||
</span>
|
||||
<i class="fas fa-chevron-down sb-chevron"></i>
|
||||
</li>
|
||||
<li class="sb-group" id="<?= $catId ?>">
|
||||
<li class="sb-group" id="<?= $catId ?>" style="--cat-color:<?= $_catColor ?>">
|
||||
<ul>
|
||||
<?php foreach ($catData['modules'] as $slug => $mod):
|
||||
$links = $mod['links'] ?? [];
|
||||
|
||||
Reference in New Issue
Block a user