File size: 4,209 Bytes
5d46e58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class CustomNavbar extends HTMLElement {
    connectedCallback() {
        this.attachShadow({ mode: 'open' });
        this.shadowRoot.innerHTML = `
            <style>
                :host {
                    display: block;
                    width: 100%;
                }
                nav {
                    background: rgba(255, 255, 255, 0.8);
                    backdrop-filter: blur(10px);
                    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
                }
                .nav-link {
                    transition: all 0.3s ease;
                    position: relative;
                }
                .nav-link:hover {
                    color: #0ea5e9;
                }
                .nav-link::after {
                    content: '';
                    position: absolute;
                    width: 0;
                    height: 2px;
                    bottom: -2px;
                    left: 0;
                    background: linear-gradient(135deg, #0ea5e9 0%, #d946ef 100%);
                    transition: width 0.3s ease;
                }
                .nav-link:hover::after {
                    width: 100%;
                }
            </style>
            <nav class="sticky top-0 z-50">
                <div class="container mx-auto px-4 py-4">
                    <div class="flex items-center justify-between">
                        <!-- Logo -->
                        <div class="flex items-center space-x-2">
                            <i data-feather="music" class="text-primary-600"></i>
                            <span class="text-xl font-bold bg-gradient-to-r from-primary-600 to-secondary-600 bg-clip-text text-transparent">
                                TuneTok Takedown
                            </span>
                        </div>

                        <!-- Navigation Links -->
                        <div class="hidden md:flex items-center space-x-8">
                            <a href="#" class="nav-link text-gray-700 font-medium">Inicio</a>
                            <a href="#how-it-works" class="nav-link text-gray-700 font-medium">Cómo funciona</a>
                            <a href="#" class="nav-link text-gray-700 font-medium">FAQ</a>
                        </div>

                        <!-- Mobile menu button -->
                        <button id="mobileMenuButton" class="md:hidden text-gray-700">
                            <i data-feather="menu"></i>
                        </button>
                    </div>

                    <!-- Mobile Menu -->
                    <div id="mobileMenu" class="hidden md:hidden mt-4 space-y-4">
                            <a href="#" class="block nav-link text-gray-700 font-medium">Inicio</a>
                            <a href="#how-it-works" class="block nav-link text-gray-700 font-medium">Cómo funciona</a>
                            <a href="#" class="block nav-link text-gray-700 font-medium">FAQ</a>
                    </div>
                </div>
            </nav>
        `;

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

        mobileMenuButton.addEventListener('click', () => {
            const isHidden = mobileMenu.classList.contains('hidden');
            if (isHidden) {
                mobileMenu.classList.remove('hidden');
                mobileMenuButton.innerHTML = '<i data-feather="x"></i>';
            } else {
                mobileMenu.classList.add('hidden');
                mobileMenuButton.innerHTML = '<i data-feather="menu"></i>';
            }
            feather.replace();
        });

        // Close mobile menu when clicking outside
        document.addEventListener('click', (event) => {
            if (!this.contains(event.target) && !mobileMenu.classList.contains('hidden')) {
                mobileMenu.classList.add('hidden');
                mobileMenuButton.innerHTML = '<i data-feather="menu"></i>';
                feather.replace();
            }
        });
    }
}

customElements.define('custom-navbar', CustomNavbar);