Mustavi's picture
the hell bro this is ugly
48c1415 verified
Raw History Blame Contribute Delete
7.99 kB
class CustomSidebar extends HTMLElement {
connectedCallback() {
const currentPage = this.getAttribute('current-page') || 'dashboard';
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
.sidebar-item {
transition: all 0.2s ease;
margin: 0.25rem 0;
border-radius: 8px;
}
.sidebar-item:hover {
background-color: rgba(14, 165, 233, 0.08);
}
.sidebar-item.active {
background-color: rgba(14, 165, 233, 0.1);
}
.sidebar-item.active svg {
color: var(--primary-600);
}
.sidebar-item.active span {
color: var(--gray-900);
font-weight: 500;
}
.sidebar-group-title {
color: var(--gray-500);
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
margin: 1.5rem 0 0.75rem 0;
padding-left: 0.75rem;
}
.sidebar-logo {
height: 3.5rem;
padding: 0 1.5rem;
border-bottom: 1px solid var(--gray-100);
}
.sidebar-logo-inner {
display: flex;
align-items: center;
height: 100%;
}
.sidebar-logo-icon {
color: var(--primary-600);
width: 1.75rem;
height: 1.75rem;
}
.sidebar-logo-text {
font-size: 1.25rem;
font-weight: 700;
color: var(--gray-900);
margin-left: 0.75rem;
}
</style>
<aside class="hidden md:flex md:flex-shrink-0">
<div class="flex flex-col w-64 h-full border-r border-gray-200 bg-white">
<!-- Logo -->
<div class="flex items-center h-16 px-6 border-b border-gray-200">
<div class="flex items-center">
<i data-feather="zap" class="text-primary-600 w-6 h-6"></i>
<span class="ml-2 text-xl font-bold text-gray-900">FlowForge</span>
</div>
</div>
<!-- Navigation -->
<div class="flex-1 overflow-y-auto">
<nav class="px-4 py-4 space-y-1">
<div class="sidebar-group-title px-3 mb-3">Dashboard</div>
<a href="#" class="sidebar-item flex items-center px-3 py-2 rounded-lg ${currentPage === 'dashboard' ? 'active' : ''}">
<i data-feather="home" class="w-5 h-5 text-gray-500"></i>
<span class="ml-3 text-gray-700">Dashboard</span>
</a>
<a href="#" class="sidebar-item flex items-center px-3 py-2 rounded-lg ${currentPage === 'flows' ? 'active' : ''}">
<i data-feather="git-branch" class="w-5 h-5 text-gray-500"></i>
<span class="ml-3 text-gray-700">Flows</span>
<span class="ml-auto px-2 py-0.5 text-xs font-medium bg-primary-100 text-primary-800 rounded-full">42</span>
</a>
<a href="#" class="sidebar-item flex items-center px-3 py-2 rounded-lg ${currentPage === 'executions' ? 'active' : ''}">
<i data-feather="play" class="w-5 h-5 text-gray-500"></i>
<span class="ml-3 text-gray-700">Executions</span>
</a>
<div class="sidebar-group-title px-3 mt-6 mb-3">Administration</div>
<a href="#" class="sidebar-item flex items-center px-3 py-2 rounded-lg ${currentPage === 'users' ? 'active' : ''}">
<i data-feather="users" class="w-5 h-5 text-gray-500"></i>
<span class="ml-3 text-gray-700">Users</span>
</a>
<a href="#" class="sidebar-item flex items-center px-3 py-2 rounded-lg ${currentPage === 'groups' ? 'active' : ''}">
<i data-feather="layers" class="w-5 h-5 text-gray-500"></i>
<span class="ml-3 text-gray-700">Groups</span>
</a>
<a href="#" class="sidebar-item flex items-center px-3 py-2 rounded-lg ${currentPage === 'roles' ? 'active' : ''}">
<i data-feather="key" class="w-5 h-5 text-gray-500"></i>
<span class="ml-3 text-gray-700">Roles</span>
</a>
<div class="sidebar-group-title px-3 mt-6 mb-3">Settings</div>
<a href="#" class="sidebar-item flex items-center px-3 py-2 rounded-lg ${currentPage === 'variables' ? 'active' : ''}">
<i data-feather="code" class="w-5 h-5 text-gray-500"></i>
<span class="ml-3 text-gray-700">Variables</span>
</a>
<a href="#" class="sidebar-item flex items-center px-3 py-2 rounded-lg ${currentPage === 'settings' ? 'active' : ''}">
<i data-feather="settings" class="w-5 h-5 text-gray-500"></i>
<span class="ml-3 text-gray-700">System Settings</span>
</a>
<a href="#" class="sidebar-item flex items-center px-3 py-2 rounded-lg ${currentPage === 'api-keys' ? 'active' : ''}">
<i data-feather="key" class="w-5 h-5 text-gray-500"></i>
<span class="ml-3 text-gray-700">API Keys</span>
</a>
<a href="#" class="sidebar-item flex items-center px-3 py-2 rounded-lg ${currentPage === 'audit-logs' ? 'active' : ''}">
<i data-feather="list" class="w-5 h-5 text-gray-500"></i>
<span class="ml-3 text-gray-700">Audit Logs</span>
</a>
</nav>
</div>
<!-- Bottom section -->
<div class="p-4 border-t border-gray-200">
<div class="flex items-center">
<div class="avatar-initials w-10 h-10 rounded-full">
SA
</div>
<div class="ml-3">
<p class="text-sm font-medium text-gray-900">Super Admin</p>
<p class="text-sm text-gray-500">Administrator</p>
</div>
</div>
</div>
</div>
</aside>
`;
}
}
customElements.define('custom-sidebar', CustomSidebar);