Spaces:
Running
Running
| class HeaderComponent extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| } | |
| .header { | |
| background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%); | |
| color: white; | |
| padding: 1rem; | |
| box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); | |
| } | |
| .container { | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| } | |
| .logo { | |
| display: flex; | |
| align-items: center; | |
| font-weight: 700; | |
| font-size: 1.5rem; | |
| } | |
| .logo-icon { | |
| margin-right: 10px; | |
| } | |
| nav ul { | |
| display: flex; | |
| list-style: none; | |
| } | |
| nav li { | |
| margin-left: 1.5rem; | |
| } | |
| nav a { | |
| color: rgba(255, 255, 255, 0.9); | |
| text-decoration: none; | |
| font-weight: 500; | |
| transition: color 0.3s; | |
| display: flex; | |
| align-items: center; | |
| } | |
| nav a:hover { | |
| color: white; | |
| } | |
| nav i { | |
| margin-right: 5px; | |
| } | |
| @media (max-width: 768px) { | |
| .container { | |
| flex-direction: column; | |
| } | |
| nav ul { | |
| margin-top: 1rem; | |
| } | |
| nav li { | |
| margin: 0 0.5rem; | |
| } | |
| } | |
| </style> | |
| <header class="header"> | |
| <div class="container"> | |
| <div class="logo"> | |
| <i data-feather="book-open" class="logo-icon"></i> | |
| <span>LinguaBot Tutor</span> | |
| </div> | |
| <nav> | |
| <ul> | |
| <li><a href="#"><i data-feather="home"></i> Home</a></li> | |
| <li><a href="#"><i data-feather="book"></i> Lessons</a></li> | |
| <li><a href="#"><i data-feather="bar-chart-2"></i> Progress</a></li> | |
| <li><a href="#"><i data-feather="user"></i> Profile</a></li> | |
| </ul> | |
| </nav> | |
| </div> | |
| </header> | |
| `; | |
| // Initialize Feather Icons | |
| const script = document.createElement('script'); | |
| script.src = 'https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js'; | |
| script.onload = () => { | |
| feather.replace(); | |
| }; | |
| this.shadowRoot.appendChild(script); | |
| } | |
| } | |
| customElements.define('header-component', HeaderComponent); |