File size: 3,866 Bytes
5a98dcb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a6c48c1
 
5a98dcb
 
 
 
 
 
 
 
 
 
 
a6c48c1
 
5a98dcb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class CustomHeader extends HTMLElement {
    connectedCallback() {
        this.attachShadow({ mode: 'open' });
        this.shadowRoot.innerHTML = `
            <style>
                .nav-link {
                    position: relative;
                }
                
                .nav-link::after {
                    content: '';
                    position: absolute;
                    width: 0;
                    height: 2px;
                    bottom: -2px;
                    left: 0;
                    background-color: #0D9488;
                    transition: width 0.3s ease;
                }
                
                .nav-link:hover::after {
                    width: 100%;
                }
                
                .mobile-menu {
                    max-height: 0;
                    overflow: hidden;
                    transition: max-height 0.3s ease-out;
                }
                
                .mobile-menu.open {
                    max-height: 500px;
                }
            </style>
            <header class="bg-white shadow-sm fixed w-full z-50">
                <div class="container mx-auto px-6 py-4">
                    <div class="flex justify-between items-center">
                        <a href="/" class="flex items-center">
                            <span class="text-2xl font-bold text-primary-600">Management Evolution</span>
                        </a>
                        
                        <div class="hidden md:flex items-center space-x-8">
                            <a href="/" class="nav-link text-gray-700 hover:text-primary-600 font-medium">Home</a>
                            <a href="#services" class="nav-link text-gray-700 hover:text-primary-600 font-medium">Services</a>
                            <a href="/about.html" class="nav-link text-gray-700 hover:text-primary-600 font-medium">About</a>
<a href="#contact" class="bg-primary-600 hover:bg-primary-700 text-white font-medium py-2 px-6 rounded-lg transition duration-300">Contact</a>
                        </div>
                        
                        <button id="mobile-menu-button" class="md:hidden text-gray-700 focus:outline-none">
                            <i data-feather="menu" class="w-6 h-6"></i>
                        </button>
                    </div>
                    
                    <div id="mobile-menu" class="mobile-menu md:hidden">
                        <div class="pt-4 pb-2 space-y-2">
                            <a href="/" class="block px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-lg">Home</a>
                            <a href="#services" class="block px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-lg">Services</a>
                            <a href="/about.html" class="block px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-lg">About</a>
<a href="#contact" class="block px-4 py-2 bg-primary-600 text-white rounded-lg text-center mt-2">Contact</a>
                        </div>
                    </div>
                </div>
            </header>
        `;

        // Initialize mobile menu functionality
        const mobileMenuButton = this.shadowRoot.getElementById('mobile-menu-button');
        const mobileMenu = this.shadowRoot.getElementById('mobile-menu');

        mobileMenuButton.addEventListener('click', () => {
            mobileMenu.classList.toggle('open');
            const icon = mobileMenuButton.querySelector('i');
            if (mobileMenu.classList.contains('open')) {
                feather.replace();
                icon.setAttribute('data-feather', 'x');
            } else {
                feather.replace();
                icon.setAttribute('data-feather', 'menu');
            }
            feather.replace();
        });
    }
}

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