Download components/admin-header.js from matheusbezerra1/sleekheader-supreme: direct link, hf CLI and curl.
- Browser
- Download file 2.04 kB
-
https://huggingface.co/spaces/matheusbezerra1/sleekheader-supreme/resolve/main/components/admin-header.js
- Command line
-
hf download hf://spaces/matheusbezerra1/sleekheader-supreme/components/admin-header.js
-
curl -L -o admin-header.js https://huggingface.co/spaces/matheusbezerra1/sleekheader-supreme/resolve/main/components/admin-header.js
2.04 kB
| class AdminHeader extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| width: 100%; | |
| position: sticky; | |
| top: 0; | |
| z-index: 50; | |
| background-color: white; | |
| box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); | |
| } | |
| .header-container { | |
| max-width: 1280px; | |
| margin: 0 auto; | |
| padding: 1rem 1.5rem; | |
| display: flex; | |
| align-items: center; | |
| justify-content: space-between; | |
| } | |
| .logo { | |
| font-size: 1.5rem; | |
| font-weight: 700; | |
| color: #3b82f6; | |
| text-decoration: none; | |
| } | |
| .nav-links { | |
| display: flex; | |
| gap: 1.5rem; | |
| } | |
| .nav-link { | |
| font-weight: 500; | |
| color: #4b5563; | |
| text-decoration: none; | |
| transition: color 0.2s; | |
| } | |
| .nav-link:hover { | |
| color: #111827; | |
| } | |
| .logout-btn { | |
| display: inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500; | |
| } | |
| </style> | |
| <div class="header-container"> | |
| <a href="/admin.html" class="logo">Luxury Estates Admin</a> | |
| <nav class="nav-links"> | |
| <a href="/admin.html" class="nav-link">Dashboard</a> | |
| <a href="/" class="nav-link">View Site</a> | |
| <button class="logout-btn" id="logoutBtn">Logout</button> | |
| </nav> | |
| </div> | |
| `; | |
| // Add logout functionality | |
| this.shadowRoot.getElementById('logoutBtn').addEventListener('click', () => { | |
| localStorage.removeItem('authToken'); | |
| window.location.href = '/login.html'; | |
| }); | |
| } | |
| } | |
| customElements.define('admin-header', AdminHeader); |