| class CustomNavbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| nav { | |
| background: white; | |
| padding: 1rem 2rem; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); | |
| position: sticky; | |
| top: 0; | |
| z-index: 50; | |
| } | |
| .logo { | |
| display: flex; | |
| align-items: center; | |
| gap: 0.5rem; | |
| font-weight: bold; | |
| color: #4f46e5; | |
| font-size: 1.25rem; | |
| } | |
| .logo-icon { | |
| width: 32px; | |
| height: 32px; | |
| } | |
| ul { | |
| display: flex; | |
| gap: 1.5rem; | |
| list-style: none; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| a { | |
| color: #4b5563; | |
| text-decoration: none; | |
| font-weight: 500; | |
| transition: color 0.2s; | |
| } | |
| a:hover { | |
| color: #4f46e5; | |
| } | |
| .active { | |
| color: #4f46e5; | |
| position: relative; | |
| } | |
| .active::after { | |
| content: ''; | |
| position: absolute; | |
| bottom: -4px; | |
| left: 0; | |
| width: 100%; | |
| height: 2px; | |
| background: #4f46e5; | |
| border-radius: 2px; | |
| } | |
| @media (max-width: 768px) { | |
| nav { | |
| flex-direction: column; | |
| gap: 1rem; | |
| padding: 1rem; | |
| } | |
| ul { | |
| width: 100%; | |
| justify-content: space-between; | |
| } | |
| } | |
| </style> | |
| <nav> | |
| <a href="/" class="logo"> | |
| <svg class="logo-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
| <path d="M12 2L2 7L12 12L22 7L12 2Z" fill="#4f46e5"/> | |
| <path d="M2 17L12 22L22 17" stroke="#4f46e5" stroke-width="2" stroke-linecap="round"/> | |
| <path d="M2 12L12 17L22 12" stroke="#4f46e5" stroke-width="2" stroke-linecap="round"/> | |
| </svg> | |
| <span>HF Hub Timeline</span> | |
| </a> | |
| <ul> | |
| <li><a href="/" class="active">Timeline</a></li> | |
| <li><a href="https://huggingface.co/docs/huggingface_hub" target="_blank">Documentation</a></li> | |
| <li><a href="https://github.com/huggingface/huggingface_hub" target="_blank">GitHub</a></li> | |
| </ul> | |
| </nav> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-navbar', CustomNavbar); |