| class CustomNavbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| width: 100%; | |
| background-color: white; | |
| box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); | |
| } | |
| nav { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| padding: 1rem 2rem; | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| } | |
| .logo { | |
| font-size: 1.5rem; | |
| font-weight: 700; | |
| color: #2563eb; | |
| display: flex; | |
| align-items: center; | |
| } | |
| .logo i { | |
| margin-right: 0.5rem; | |
| } | |
| .nav-links { | |
| display: flex; | |
| gap: 2rem; | |
| } | |
| .nav-links a { | |
| color: #4b5563; | |
| font-weight: 500; | |
| text-decoration: none; | |
| transition: color 0.2s; | |
| } | |
| .nav-links a:hover { | |
| color: #2563eb; | |
| } | |
| .login-btn { | |
| background-color: #2563eb; | |
| color: white; | |
| padding: 0.5rem 1rem; | |
| border-radius: 0.375rem; | |
| transition: background-color 0.2s; | |
| } | |
| .login-btn:hover { | |
| background-color: #1d4ed8; | |
| } | |
| @media (max-width: 768px) { | |
| nav { | |
| flex-direction: column; | |
| padding: 1rem; | |
| } | |
| .nav-links { | |
| margin-top: 1rem; | |
| gap: 1rem; | |
| } | |
| } | |
| </style> | |
| <nav> | |
| <a href="/" class="logo"> | |
| <i data-feather="code"></i> | |
| Python Pathfinder | |
| </a> | |
| <div class="nav-links"> | |
| <a href="/">Home</a> | |
| <a href="/assessment.html">Assessment</a> | |
| <a href="/beginner.html">Courses</a> | |
| <a href="#">About</a> | |
| <a href="#" class="login-btn">Sign In</a> | |
| </div> | |
| </nav> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-navbar', CustomNavbar); |