Spaces:
Running

enciso7's picture
Can you make fix the visualization and colors of the menu?
64b88ab verified
Raw History Blame Contribute Delete
4.55 kB
class CustomSidebar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
.sidebar {
position: fixed;
top: 64px;
left: 0;
bottom: 0;
width: 256px;
background: white;
border-right: 1px solid #e2e8f0;
transition: transform 0.3s, background-color 0.3s;
z-index: 20;
}
.dark .sidebar {
background: #1e293b;
border-right-color: #334155;
}
@media (max-width: 1024px) {
.sidebar {
transform: translateX(-100%);
}
.sidebar.open {
transform: translateX(0);
}
}
.nav-link {
display: flex;
align-items: center;
padding: 12px 16px;
border-radius: 8px;
color: #64748b;
transition: all 0.2s;
font-weight: 500;
margin: 4px 0;
}
.nav-link:hover {
background: rgba(14, 165, 233, 0.1);
color: #0ea5e9;
}
.dark .nav-link:hover {
background: rgba(14, 165, 233, 0.2);
color: #7dd3fc;
}
.nav-link.active {
background: rgba(14, 165, 233, 0.15);
color: #0ea5e9;
font-weight: 600;
}
.dark .nav-link.active {
background: rgba(14, 165, 233, 0.25);
color: #7dd3fc;
}
.nav-link i {
margin-right: 12px;
width: 20px;
height: 20px;
}
</style>
<aside class="sidebar dark:bg-gray-800">
<div class="p-4">
<nav class="space-y-1">
<a href="#" class="nav-link active">
<i data-feather="home"></i>
<span>Dashboard</span>
</a>
<a href="#" class="nav-link">
<i data-feather="dollar-sign"></i>
<span>Transactions</span>
</a>
<a href="#" class="nav-link">
<i data-feather="file-text"></i>
<span>Invoices</span>
</a>
<a href="#" class="nav-link">
<i data-feather="credit-card"></i>
<span>Expenses</span>
</a>
<a href="#" class="nav-link">
<i data-feather="users"></i>
<span>Clients</span>
</a>
<a href="#" class="nav-link">
<i data-feather="pie-chart"></i>
<span>Reports</span>
</a>
<a href="#" class="nav-link">
<i data-feather="settings"></i>
<span>Settings</span>
</a>
</nav>
<div class="mt-8 pt-6 border-t border-gray-200 dark:border-gray-700">
<h3 class="text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4">ACCOUNT</h3>
<a href="#" class="nav-link">
<i data-feather="user"></i>
<span>Profile</span>
</a>
<a href="#" class="nav-link">
<i data-feather="log-out"></i>
<span>Logout</span>
</a>
</div>
</div>
</aside>
`;
}
}
customElements.define('custom-sidebar', CustomSidebar);