Spaces:
Running
Running
Download components/header.js from Maqsadov/testmaster-pro: direct link, hf CLI and curl.
- Browser
- Download file 2.93 kB
-
https://huggingface.co/spaces/Maqsadov/testmaster-pro/resolve/main/components/header.js
- Command line
-
hf download hf://spaces/Maqsadov/testmaster-pro/components/header.js
-
curl -L -o header.js https://huggingface.co/spaces/Maqsadov/testmaster-pro/resolve/main/components/header.js
2.93 kB
| class HeaderComponent extends HTMLElement { | |
| connectedCallback() { | |
| this.innerHTML = ` | |
| <header class="bg-white shadow-sm"> | |
| <div class="container mx-auto px-4"> | |
| <div class="flex justify-between items-center py-4"> | |
| <div class="flex items-center"> | |
| <a href="index.html" class="text-2xl font-bold text-blue-600 flex items-center"> | |
| <i data-feather="book-open" class="mr-2"></i> | |
| <span>TestMaster Pro</span> | |
| </a> | |
| </div> | |
| <nav class="hidden md:block"> | |
| <ul class="flex space-x-8"> | |
| <li><a href="index.html" class="text-gray-600 hover:text-blue-600 font-medium">Bosh Sahifa</a></li> | |
| <li><a href="create-test.html" class="text-gray-600 hover:text-blue-600 font-medium">Test Yaratish</a></li> | |
| <li><a href="take-test.html" class="text-gray-600 hover:text-blue-600 font-medium">Test Tekshirish</a></li> | |
| <li><a href="results.html" class="text-gray-600 hover:text-blue-600 font-medium">Natijalar</a></li> | |
| </ul> | |
| </nav> | |
| <div class="flex items-center space-x-4"> | |
| <user-menu></user-menu> | |
| <div class="md:hidden"> | |
| <button id="mobile-menu-button" class="text-gray-500 hover:text-gray-700"> | |
| <i data-feather="menu" class="w-6 h-6"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Mobile menu --> | |
| <div id="mobile-menu" class="hidden md:hidden bg-white border-t"> | |
| <div class="container mx-auto px-4 py-4"> | |
| <ul class="space-y-3"> | |
| <li><a href="index.html" class="block text-gray-600 hover:text-blue-600 font-medium py-2">Bosh Sahifa</a></li> | |
| <li><a href="create-test.html" class="block text-gray-600 hover:text-blue-600 font-medium py-2">Test Yaratish</a></li> | |
| <li><a href="take-test.html" class="block text-gray-600 hover:text-blue-600 font-medium py-2">Test Tekshirish</a></li> | |
| <li><a href="results.html" class="block text-gray-600 hover:text-blue-600 font-medium py-2">Natijalar</a></li> | |
| </ul> | |
| </div> | |
| </div> | |
| </header> | |
| `; | |
| // Add mobile menu toggle functionality | |
| const mobileMenuButton = this.querySelector('#mobile-menu-button'); | |
| const mobileMenu = this.querySelector('#mobile-menu'); | |
| mobileMenuButton.addEventListener('click', () => { | |
| mobileMenu.classList.toggle('hidden'); | |
| const menuIcon = mobileMenuButton.querySelector('i'); | |
| if (mobileMenu.classList.contains('hidden')) { | |
| menuIcon.setAttribute('data-feather', 'menu'); | |
| } else { | |
| menuIcon.setAttribute('data-feather', 'x'); | |
| } | |
| feather.replace(); | |
| }); | |
| } | |
| } | |
| customElements.define('header-component', HeaderComponent); | |