Spaces:
Running
Running
| 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 1px 3px rgba(0,0,0,0.1); | |
| position: relative; | |
| z-index: 50; | |
| } | |
| .logo { | |
| font-weight: bold; | |
| font-size: 1.5rem; | |
| color: #1a1a1a; | |
| display: flex; | |
| align-items: center; | |
| } | |
| .logo-icon { | |
| margin-right: 0.5rem; | |
| color: #3b82f6; | |
| } | |
| .nav-links { | |
| display: flex; | |
| gap: 2rem; | |
| list-style: none; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| .nav-links a { | |
| color: #4b5563; | |
| text-decoration: none; | |
| font-weight: 500; | |
| transition: color 0.2s; | |
| } | |
| .nav-links a:hover { | |
| color: #3b82f6; | |
| } | |
| .auth-buttons { | |
| display: flex; | |
| gap: 1rem; | |
| } | |
| .login { | |
| color: #4b5563; | |
| padding: 0.5rem 1rem; | |
| border-radius: 0.375rem; | |
| transition: all 0.2s; | |
| } | |
| .login:hover { | |
| color: #3b82f6; | |
| } | |
| .signup { | |
| background: #3b82f6; | |
| color: white; | |
| padding: 0.5rem 1rem; | |
| border-radius: 0.375rem; | |
| transition: all 0.2s; | |
| } | |
| .signup:hover { | |
| background: #2563eb; | |
| } | |
| @media (max-width: 768px) { | |
| .nav-links { | |
| display: none; | |
| } | |
| .auth-buttons { | |
| display: none; | |
| } | |
| .mobile-menu { | |
| display: block; | |
| } | |
| } | |
| </style> | |
| <nav> | |
| <a href="/" class="logo"> | |
| <i data-feather="compass" class="logo-icon"></i> | |
| Knowledge Navigator | |
| </a> | |
| <ul class="nav-links"> | |
| <li><a href="#">Topics</a></li> | |
| <li><a href="#">Roadmaps</a></li> | |
| <li><a href="#">Resources</a></li> | |
| <li><a href="#">Community</a></li> | |
| </ul> | |
| <div class="auth-buttons"> | |
| <a href="#" class="login">Log in</a> | |
| <a href="#" class="signup">Sign up</a> | |
| </div> | |
| <button class="mobile-menu hidden"> | |
| <i data-feather="menu"></i> | |
| </button> | |
| </nav> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-navbar', CustomNavbar); |