File size: 4,209 Bytes
bde7409
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
class CustomHeader extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        :host {
          display: block;
        }
        
        .header {
          background-color: white;
          box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
          position: sticky;
          top: 0;
          z-index: 50;
        }
        
        .nav-link {
          color: #4b5563;
          font-weight: 500;
          transition: color 0.3s;
          position: relative;
        }
        
        .nav-link:hover {
          color: #6366f1;
        }
        
        .nav-link::after {
          content: '';
          position: absolute;
          bottom: -5px;
          left: 0;
          width: 0;
          height: 2px;
          background-color: #6366f1;
          transition: width 0.3s;
        }
        
        .nav-link:hover::after {
          width: 100%;
        }
        
        .mobile-menu {
          display: none;
        }
        
        @media (max-width: 768px) {
          .desktop-menu {
            display: none;
          }
          
          .mobile-menu {
            display: block;
          }
        }
      </style>
      
      <header class="header">
        <div class="container mx-auto px-4">
          <div class="flex items-center justify-between h-20">
            <div class="flex items-center">
              <a href="/" class="text-2xl font-bold text-indigo-600">AppLander<span class="text-gray-900">Pro</span></a>
            </div>
            
            <div class="desktop-menu">
              <nav class="flex space-x-8">
                <a href="#" class="nav-link">Features</a>
                <a href="#" class="nav-link">How It Works</a>
                <a href="#" class="nav-link">Pricing</a>
                <a href="#" class="nav-link">Testimonials</a>
              </nav>
            </div>
            
            <div class="flex items-center space-x-4">
              <a href="#" class="text-gray-600 hover:text-gray-900 font-medium">Sign In</a>
              <a href="#" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-2 px-6 rounded-lg transition duration-300">Get Started</a>
              
              <div class="mobile-menu">
                <button id="mobile-menu-button" class="text-gray-500 hover:text-gray-900">
                  <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">
          <div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
            <a href="#" class="block px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-gray-900 hover:bg-gray-50">Features</a>
            <a href="#" class="block px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-gray-900 hover:bg-gray-50">How It Works</a>
            <a href="#" class="block px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-gray-900 hover:bg-gray-50">Pricing</a>
            <a href="#" class="block px-3 py-2 rounded-md text-base font-medium text-gray-700 hover:text-gray-900 hover:bg-gray-50">Testimonials</a>
          </div>
        </div>
      </header>
    `;
    
    // Add mobile menu toggle functionality
    setTimeout(() => {
      const menuButton = this.shadowRoot.getElementById('mobile-menu-button');
      const mobileMenu = this.shadowRoot.getElementById('mobile-menu');
      
      if (menuButton && mobileMenu) {
        menuButton.addEventListener('click', () => {
          const isExpanded = menuButton.getAttribute('aria-expanded') === 'true';
          menuButton.setAttribute('aria-expanded', !isExpanded);
          mobileMenu.classList.toggle('hidden');
          
          // Toggle feather icons
          const menuIcon = menuButton.querySelector('i');
          if (menuIcon) {
            menuIcon.setAttribute('data-feather', isExpanded ? 'menu' : 'x');
            feather.replace();
          }
        });
      }
    }, 0);
  }
}

customElements.define('custom-header', CustomHeader);