You are a senior front-end developer and UI/UX designer specializing in e-commerce experiences. Create a **production-ready, responsive mystery-box marketplace website** that combines modern design aesthetics with optimal user experience.
4180850
verified
| class CustomHeader extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| width: 100%; | |
| } | |
| .header-container { | |
| background: white; | |
| box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1); | |
| position: sticky; | |
| top: 0; | |
| z-index: 40; | |
| } | |
| .nav-link { | |
| transition: all 0.3s ease; | |
| } | |
| .nav-link:hover { | |
| color: #0D9488; | |
| } | |
| .mobile-menu { | |
| transform: translateX(-100%); | |
| transition: transform 0.3s ease; | |
| } | |
| .mobile-menu.open { | |
| transform: translateX(0); | |
| } | |
| @media (max-width: 768px) { | |
| .desktop-nav { | |
| display: none; | |
| } | |
| } | |
| @media (min-width: 769px) { | |
| .mobile-menu-button { | |
| display: none; | |
| } | |
| } | |
| </style> | |
| <header class="header-container"> | |
| <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-2"> | |
| <div class="w-10 h-10 bg-primary rounded-xl flex items-center justify-center"> | |
| <i data-feather="package" class="w-6 h-6 text-white"></i> | |
| </div> | |
| <span class="text-xl font-bold text-gray-900">MysteryVault</span> | |
| </a> | |
| <!-- Desktop Navigation --> | |
| <div class="desktop-nav hidden md:flex items-center space-x-8"> | |
| <a href="#boxes" class="nav-link text-neutral hover:text-primary font-medium">Boxes</a> | |
| <a href="#how-it-works" class="nav-link text-neutral hover:text-primary font-medium">How It Works</a> | |
| <a href="#features" class="nav-link text-neutral hover:text-primary font-medium">Features</a> | |
| <a href="#" class="nav-link text-neutral hover:text-primary font-medium">About</a> | |
| </div> | |
| <!-- Desktop CTA --> | |
| <div class="hidden md:flex items-center space-x-4"> | |
| <a href="#" class="nav-link text-neutral hover:text-primary font-medium"> | |
| <i data-feather="user" class="w-5 h-5"></i> | |
| </a> | |
| <!-- Mobile Menu Button --> | |
| <button class="mobile-menu-button md:hidden p-2 rounded-lg hover:bg-gray-100 transition-colors" aria-label="Toggle menu"> | |
| <i data-feather="menu" class="w-6 h-6 text-neutral"></i> | |
| </button> | |
| </div> | |
| <!-- Mobile Menu --> | |
| <div id="mobileMenu" class="mobile-menu md:hidden fixed inset-0 bg-white z-50 p-6"> | |
| <div class="flex justify-between items-center mb-8"> | |
| <a href="/" class="flex items-center space-x-2"> | |
| <div class="w-8 h-8 bg-primary rounded-lg flex items-center justify-center"> | |
| <i data-feather="package" class="w-5 h-5 text-white"></i> | |
| </div> | |
| <span class="text-lg font-bold text-gray-900">MysteryVault</span> | |
| </a> | |
| <button class="close-mobile-menu p-2 rounded-lg hover:bg-gray-100 transition-colors" aria-label="Close menu"> | |
| <i data-feather="x" class="w-6 h-6 text-neutral"></i> | |
| </button> | |
| </div> | |
| <div class="space-y-6"> | |
| <a href="#boxes" class="block text-xl font-semibold text-neutral hover:text-primary transition-colors">Boxes</a> | |
| <a href="#how-it-works" class="block text-xl font-semibold text-neutral hover:text-primary transition-colors">How It Works</a> | |
| <a href="#features" class="block text-xl font-semibold text-neutral hover:text-primary transition-colors">Features</a> | |
| <a href="#" class="block text-xl font-semibold text-neutral hover:text-primary transition-colors">About</a> | |
| <a href="#" class="block text-xl font-semibold text-neutral hover:text-primary transition-colors">Contact</a> | |
| </div> | |
| </div> | |
| </nav> | |
| </header> | |
| `; | |
| // Add mobile menu functionality | |
| this.setupMobileMenu(); | |
| } | |
| setupMobileMenu() { | |
| const menuButton = this.shadowRoot.querySelector('.mobile-menu-button'); | |
| const closeButton = this.shadowRoot.querySelector('.close-mobile-menu'); | |
| const mobileMenu = this.shadowRoot.getElementById('mobileMenu'); | |
| if (menuButton && mobileMenu) { | |
| menuButton.addEventListener('click', () => { | |
| mobileMenu.classList.add('open'); | |
| document.body.style.overflow = 'hidden'; | |
| }); | |
| if (closeButton) { | |
| closeButton.addEventListener('click', () => { | |
| mobileMenu.classList.remove('open'); | |
| document.body.style.overflow = ''; | |
| }); | |
| } | |
| // Close menu when clicking on links | |
| mobileMenu.querySelectorAll('a').forEach(link => { | |
| link.addEventListener('click', () => { | |
| mobileMenu.classList.remove('open'); | |
| document.body.style.overflow = ''; | |
| }); | |
| } | |
| } | |
| } | |
| } | |
| customElements.define('custom-header', CustomHeader); |