ืฉืืฉ ืืืคืฆืื ืฉื ืืืื / ืขืืืื ืืืฉื ืืื ืจืง ืืคืฉืจ ืืืขืืืช ืงืืฆืื ืืื ืืกืืจ ืื ืืช ืื ืืคื ืืื ืฉืงืจืืช ืืขืืืื ืืืจื ืฉืืขืืช ืืช ืืงืืฆืื ืืชื ืืืืจ ืื ืื ืื ืฉืืื ืืขืฉื (ืืจืืืกืืืช ืขื ืฉืืืืช/ืืืื ืื/ืกืืืืืื ืืขืื) ื ืืกืฃ ืขื ืื ืชืขืฉื ืฉืืื ื ืฉืืคืฉืจ ืืขืฉืืช ืืฉืื ืฆืจืื ืืืืจืฉื ืืืจืฉืื ืืช ืืืืื ืืื ืคืขื ืฉืืืฉืื ื ืจืฉื ืืื ืืงืื ืืืืื ืืืืขื ( ืืจืื ืืื ืstudy mate ืื ืืกืฃ ืชืืจืื ืืช ืืชืืื ื ืฉืฉืืช ืืชืขืฆื ืืช ืืืชืจ ืฉืืืื ืืืฉ ืืืฉืงืข ืืื ืฆืืขืื ืจืืืขืื
6110ac3
verified
| class CustomNavbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| nav { | |
| background: linear-gradient(90deg, #4f46e5, #7c3aed); | |
| color: white; | |
| padding: 1rem 2rem; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| box-shadow: 0 4px 6px rgba(0,0,0,0.1); | |
| position: sticky; | |
| top: 0; | |
| z-index: 1000; | |
| } | |
| .logo { | |
| display: flex; | |
| align-items: center; | |
| font-weight: bold; | |
| font-size: 1.5rem; | |
| gap: 10px; | |
| } | |
| .logo img { | |
| height: 40px; | |
| } | |
| .nav-links { | |
| display: flex; | |
| gap: 20px; | |
| } | |
| .nav-links a { | |
| color: white; | |
| text-decoration: none; | |
| padding: 0.5rem 1rem; | |
| border-radius: 8px; | |
| transition: background 0.3s; | |
| } | |
| .nav-links a:hover { | |
| background: rgba(255,255,255,0.2); | |
| } | |
| .nav-links a.active { | |
| background: rgba(255,255,255,0.3); | |
| } | |
| @media (max-width: 768px) { | |
| nav { | |
| flex-direction: column; | |
| padding: 1rem; | |
| } | |
| .nav-links { | |
| margin-top: 1rem; | |
| width: 100%; | |
| justify-content: space-around; | |
| } | |
| } | |
| </style> | |
| <nav> | |
| <div class="logo"> | |
| <i class="fas fa-graduation-cap" style="font-size: 2rem;"></i> | |
| <span>StudyMate</span> | |
| </div> | |
| <div class="nav-links"> | |
| <a href="/" class="active">ืืืช</a> | |
| <a href="/materials.html">ืืืืจืื</a> | |
| <a href="/grades.html">ืฆืืื ืื</a> | |
| <a href="/profile.html">ืคืจืืคืื</a> | |
| </div> | |
| </nav> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-navbar', CustomNavbar); |