Spaces:
Running
Running
| class CustomNavbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| nav { | |
| background: white; | |
| padding: 1.5rem 2rem; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); | |
| position: sticky; | |
| top: 0; | |
| z-index: 100; | |
| } | |
| .logo { | |
| color: #059669; | |
| font-weight: 800; | |
| font-size: 1.75rem; | |
| font-family: 'Space Grotesk', sans-serif; | |
| display: flex; | |
| align-items: center; | |
| gap: 0.5rem; | |
| } | |
| .logo-icon { | |
| color: #f59e0b; | |
| } | |
| ul { | |
| display: flex; | |
| gap: 2rem; | |
| list-style: none; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| a { | |
| color: #374151; | |
| text-decoration: none; | |
| font-weight: 600; | |
| transition: color 0.2s; | |
| position: relative; | |
| } | |
| a:hover { | |
| color: #059669; | |
| } | |
| a:hover::after { | |
| content: ''; | |
| position: absolute; | |
| bottom: -5px; | |
| left: 0; | |
| width: 100%; | |
| height: 2px; | |
| background: #059669; | |
| } | |
| .auth-buttons { | |
| display: flex; | |
| gap: 1rem; | |
| } | |
| .login { | |
| padding: 0.75rem 1.5rem; | |
| border-radius: 0.75rem; | |
| font-weight: 600; | |
| transition: all 0.2s; | |
| } | |
| .login-outline { | |
| border: 2px solid #059669; | |
| color: #059669; | |
| } | |
| .login-solid { | |
| background: #059669; | |
| color: white; | |
| } | |
| .login-outline:hover { | |
| background: #059669; | |
| color: white; | |
| } | |
| .login-solid:hover { | |
| background: #047857; | |
| transform: translateY(-2px); | |
| } | |
| @media (max-width: 768px) { | |
| nav { | |
| flex-direction: column; | |
| gap: 1rem; | |
| padding: 1rem; | |
| } | |
| ul { | |
| gap: 1rem; | |
| } | |
| .auth-buttons { | |
| width: 100%; | |
| justify-content: center; | |
| } | |
| } | |
| </style> | |
| <nav> | |
| <div class="logo"> | |
| <i data-feather="code" class="logo-icon"></i> | |
| AI Website Builder | |
| </div> | |
| <ul> | |
| <li><a href="/">Home</a></li> | |
| <li><a href="#">Features</a></li> | |
| <li><a href="#">Examples</a></li> | |
| <li><a href="#">Pricing</a></li> | |
| </ul> | |
| <div class="auth-buttons"> | |
| <a href="#" class="login login-outline">Log In</a> | |
| <a href="#" class="login login-solid">Sign Up Free</a> | |
| </div> | |
| </nav> | |
| `; | |
| // Initialize feather icons after DOM content is added | |
| setTimeout(() => { | |
| const script = document.createElement('script'); | |
| script.src = 'https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js'; | |
| script.onload = () => { | |
| if (typeof feather !== 'undefined') { | |
| feather.replace(); | |
| } | |
| }; | |
| this.shadowRoot.appendChild(script); | |
| }, 0); | |
| } | |
| } | |
| customElements.define('custom-navbar', CustomNavbar); |