Spaces:
Running
Running
Download components/admin-navbar.js from dymic/dymic-digital-admin-suite: direct link, hf CLI and curl.
- Browser
- Download file 4.48 kB
-
https://huggingface.co/spaces/dymic/dymic-digital-admin-suite/resolve/main/components/admin-navbar.js
- Command line
-
hf download hf://spaces/dymic/dymic-digital-admin-suite/components/admin-navbar.js
-
curl -L -o admin-navbar.js https://huggingface.co/spaces/dymic/dymic-digital-admin-suite/resolve/main/components/admin-navbar.js
4.48 kB
| class CustomAdminNavbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| .navbar { | |
| background: rgba(2, 6, 23, 0.9); | |
| backdrop-filter: blur(10px); | |
| -webkit-backdrop-filter: blur(10px); | |
| border-bottom: 1px solid rgba(255, 255, 255, 0.1); | |
| position: fixed; | |
| width: 100%; | |
| top: 0; | |
| z-index: 40; | |
| } | |
| .nav-link { | |
| position: relative; | |
| } | |
| .nav-link::after { | |
| content: ''; | |
| position: absolute; | |
| bottom: -2px; | |
| left: 0; | |
| width: 0; | |
| height: 2px; | |
| background-color: #3b82f6; | |
| transition: width 0.3s ease; | |
| } | |
| .nav-link:hover::after { | |
| width: 100%; | |
| } | |
| .profile-menu { | |
| display: none; | |
| position: absolute; | |
| right: 0; | |
| top: 100%; | |
| min-width: 200px; | |
| background: #1e293b; | |
| border-radius: 0.5rem; | |
| box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); | |
| z-index: 50; | |
| } | |
| .profile-menu.open { | |
| display: block; | |
| } | |
| </style> | |
| <nav class="navbar"> | |
| <div class="container mx-auto px-6 py-4"> | |
| <div class="flex justify-between items-center"> | |
| <!-- Logo --> | |
| <a href="index.html" class="text-2xl font-bold flex items-center"> | |
| <span class="text-accent">DDS</span> | |
| <span class="text-white">olutions</span> | |
| </a> | |
| <!-- Right Side --> | |
| <div class="flex items-center space-x-6"> | |
| <div class="relative"> | |
| <button id="profile-button" class="flex items-center space-x-2 focus:outline-none"> | |
| <div class="w-8 h-8 rounded-full bg-accent flex items-center justify-center text-white font-semibold">A</div> | |
| <span class="hidden md:inline">Admin</span> | |
| </button> | |
| <div id="profile-menu" class="profile-menu mt-2 py-2 border border-gray-700"> | |
| <a href="index.html" class="block px-4 py-2 text-gray-300 hover:bg-gray-700 hover:text-white">View Site</a> | |
| <button id="logout-btn" class="w-full text-left px-4 py-2 text-gray-300 hover:bg-gray-700 hover:text-white">Logout</button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </nav> | |
| <script> | |
| feather.replace(); | |
| // Profile menu toggle | |
| const profileButton = this.shadowRoot.getElementById('profile-button'); | |
| const profileMenu = this.shadowRoot.getElementById('profile-menu'); | |
| profileButton.addEventListener('click', (e) => { | |
| e.stopPropagation(); | |
| profileMenu.classList.toggle('open'); | |
| }); | |
| // Close profile menu when clicking outside | |
| document.addEventListener('click', () => { | |
| profileMenu.classList.remove('open'); | |
| }); | |
| // Logout functionality | |
| this.shadowRoot.getElementById('logout-btn').addEventListener('click', () => { | |
| localStorage.removeItem('adminLoggedIn'); | |
| window.location.href = 'index.html'; | |
| }); | |
| </script> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-admin-navbar', CustomAdminNavbar); |