| class CustomNavbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| nav { | |
| background-color: var(--primary-color); | |
| color: var(--light-text); | |
| padding: 1rem 2rem; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| box-shadow: var(--shadow-md); | |
| position: sticky; | |
| top: 0; | |
| z-index: 1000; | |
| } | |
| .logo { | |
| display: flex; | |
| align-items: center; | |
| font-weight: bold; | |
| font-size: 1.2rem; | |
| } | |
| .logo img { | |
| height: 40px; | |
| margin-left: 10px; | |
| } | |
| .nav-links { | |
| display: flex; | |
| gap: 20px; | |
| } | |
| .nav-links a { | |
| color: white; | |
| text-decoration: none; | |
| padding: 0.5rem 1rem; | |
| border-radius: 5px; | |
| transition: background-color 0.3s; | |
| } | |
| .nav-links a:hover { | |
| background-color: rgba(255, 255, 255, 0.2); | |
| } | |
| @media (max-width: 768px) { | |
| nav { | |
| flex-direction: column; | |
| padding: 1rem; | |
| } | |
| .nav-links { | |
| margin-top: 1rem; | |
| width: 100%; | |
| justify-content: space-around; | |
| } | |
| .nav-links a { | |
| padding: 0.5rem; | |
| } | |
| } | |
| </style> | |
| <nav> | |
| <div class="logo"> | |
| <img src="http://static.photos/education/200x200/1" alt="School Logo"> | |
| <span>ืืืช ืกืคืจ ืืฆืืง ืฉืืืจ</span> | |
| </div> | |
| <div class="nav-links"> | |
| <a href="/">ืืืช</a> | |
| <a href="/chat.html">ืฆ'ืื AI</a> | |
| <a href="/materials.html">ืืืืจื ืืืืื</a> | |
| <a href="/announcements.html">ืืืจืืืช</a> | |
| <a href="/login.html">ืืชืืืจืืช</a> | |
| </div> | |
| </nav> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-navbar', CustomNavbar); |