Spaces:
Running
Running
Download components/header.js from wisdomgreat/simcoe-connect-hub: direct link, hf CLI and curl.
- Browser
- Download file 7.14 kB
-
https://huggingface.co/spaces/wisdomgreat/simcoe-connect-hub/resolve/main/components/header.js
- Command line
-
hf download hf://spaces/wisdomgreat/simcoe-connect-hub/components/header.js
-
curl -L -o header.js https://huggingface.co/spaces/wisdomgreat/simcoe-connect-hub/resolve/main/components/header.js
7.14 kB
| class CustomHeader extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| width: 100%; | |
| } | |
| .header { | |
| background: rgba(255, 255, 255, 0.95); | |
| backdrop-filter: blur(10px); | |
| border-bottom: 1px solid rgba(0, 0, 0, 0.1); | |
| } | |
| .mobile-menu { | |
| transform: translateX(-100%); | |
| transition: transform 0.3s ease; | |
| } | |
| .mobile-menu.open { | |
| transform: translateX(0); | |
| } | |
| @media (min-width: 768px) { | |
| .mobile-menu { | |
| transform: none; | |
| } | |
| } | |
| </style> | |
| <header class="header sticky top-0 z-40"> | |
| <nav class="container mx-auto px-4 py-4"> | |
| <div class="flex items-center justify-between"> | |
| <!-- Logo --> | |
| <a href="/" class="flex items-center space-x-3"> | |
| <div class="w-10 h-10 bg-gradient-to-br from-primary-500 to-secondary-500 rounded-xl flex items-center justify-center text-white font-bold"> | |
| SC | |
| </div> | |
| <span class="text-xl font-bold text-gray-900">Simcoe Connect</span> | |
| </a> | |
| <!-- Desktop Navigation --> | |
| <div class="hidden md:flex items-center space-x-8"> | |
| <a href="/businesses" class="text-gray-700 hover:text-primary-600 font-medium transition-colors">Businesses</a> | |
| <a href="/events" class="text-gray-700 hover:text-primary-600 font-medium transition-colors">Events</a> | |
| <a href="/jobs" class="text-gray-700 hover:text-primary-600 font-medium transition-colors">Jobs</a> | |
| <a href="/services" class="text-gray-700 hover:text-primary-600 font-medium transition-colors">Services</a> | |
| </div> | |
| <!-- Desktop Actions --> | |
| <div class="hidden md:flex items-center space-x-4"> | |
| <button class="text-gray-600 hover:text-gray-900 transition-colors"> | |
| <i data-feather="search" class="w-5 h-5"></i> | |
| </button> | |
| <a href="/login" class="text-gray-700 hover:text-primary-600 font-medium transition-colors">Login</a> | |
| <a href="/signup" class="bg-primary-500 hover:bg-primary-600 text-white px-4 py-2 rounded-lg transition-colors font-medium"> | |
| Sign Up | |
| </a> | |
| </div> | |
| <!-- Mobile Menu Button --> | |
| <button id="mobileMenuButton" class="md:hidden text-gray-600 hover:text-gray-900"> | |
| <i data-feather="menu" class="w-6 h-6"></i> | |
| </button> | |
| </div> | |
| <!-- Mobile Menu --> | |
| <div id="mobileMenu" class="mobile-menu md:hidden fixed inset-y-0 left-0 w-64 bg-white shadow-xl z-50"> | |
| <div class="p-6"> | |
| <div class="flex items-center justify-between mb-8"> | |
| <a href="/" class="flex items-center space-x-3"> | |
| <div class="w-8 h-8 bg-gradient-to-br from-primary-500 to-secondary-500 rounded-lg flex items-center justify-center text-white font-bold"> | |
| SC | |
| </div> | |
| <span class="text-lg font-bold text-gray-900">Simcoe Connect</span> | |
| </a> | |
| <button id="closeMobileMenu" class="text-gray-600 hover:text-gray-900"> | |
| <i data-feather="x" class="w-6 h-6"></i> | |
| </button> | |
| </div> | |
| <div class="space-y-6"> | |
| <a href="/businesses" class="block text-gray-700 hover:text-primary-600 font-medium transition-colors">Businesses</a> | |
| <a href="/events" class="block text-gray-700 hover:text-primary-600 font-medium transition-colors">Events</a> | |
| <a href="/jobs" class="block text-gray-700 hover:text-primary-600 font-medium transition-colors">Jobs</a> | |
| <a href="/services" class="block text-gray-700 hover:text-primary-600 font-medium transition-colors">Services</a> | |
| <div class="pt-6 border-t border-gray-200"> | |
| <a href="/login" class="block text-gray-700 hover:text-primary-600 font-medium transition-colors mb-4">Login</a> | |
| <a href="/signup" class="block bg-primary-500 hover:bg-primary-600 text-white px-4 py-2 rounded-lg transition-colors font-medium text-center"> | |
| Sign Up | |
| </a> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </nav> | |
| </header> | |
| `; | |
| // Add mobile menu functionality | |
| const mobileMenuButton = this.shadowRoot.getElementById('mobileMenuButton'); | |
| const closeMobileMenu = this.shadowRoot.getElementById('closeMobileMenu'); | |
| const mobileMenu = this.shadowRoot.getElementById('mobileMenu'); | |
| const overlay = document.createElement('div'); | |
| overlay.className = 'fixed inset-0 bg-black bg-opacity-50 z-40 md:hidden'; | |
| overlay.style.display = 'none'; | |
| mobileMenuButton.addEventListener('click', () => { | |
| mobileMenu.classList.add('open'); | |
| overlay.style.display = 'block'; | |
| document.body.appendChild(overlay); | |
| document.body.style.overflow = 'hidden'; | |
| feather.replace(); | |
| }); | |
| closeMobileMenu.addEventListener('click', () => { | |
| mobileMenu.classList.remove('open'); | |
| overlay.style.display = 'none'; | |
| document.body.style.overflow = ''; | |
| }); | |
| overlay.addEventListener('click', () => { | |
| mobileMenu.classList.remove('open'); | |
| overlay.style.display = 'none'; | |
| document.body.style.overflow = ''; | |
| }); | |
| // Initialize feather icons | |
| setTimeout(() => { | |
| feather.replace(); | |
| }, 100); | |
| } | |
| } | |
| customElements.define('custom-header', CustomHeader); |