File size: 3,817 Bytes
11e7a09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d653834
11e7a09
 
 
d653834
 
11e7a09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class CustomNavbar extends HTMLElement {
    connectedCallback() {
        this.attachShadow({ mode: 'open' });
        this.shadowRoot.innerHTML = `
            <style>
                nav {
                    background-color: rgba(17, 24, 39, 0.8);
                    backdrop-filter: blur(8px);
                    -webkit-backdrop-filter: blur(8px);
                }
                .nav-link {
                    position: relative;
                }
                .nav-link::after {
                    content: '';
                    position: absolute;
                    bottom: -2px;
                    left: 0;
                    width: 0;
                    height: 2px;
                    background: linear-gradient(to right, #ef4444, #d946ef);
                    transition: width 0.3s ease;
                }
                .nav-link:hover::after {
                    width: 100%;
                }
                .theme-toggle {
                    transition: all 0.3s ease;
                }
                .theme-toggle:hover {
                    transform: rotate(30deg);
                }
            </style>
            <nav class="fixed w-full z-50 border-b border-gray-800">
                <div class="container mx-auto px-4">
                    <div class="flex items-center justify-between h-16">
                        <a href="#" class="flex items-center">
                            <span class="text-xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-primary to-secondary">
                                NoirScape
                            </span>
                        </a>
                        
                        <div class="hidden md:flex items-center space-x-8">
                            <a href="/" class="nav-link text-gray-300 hover:text-white">Home</a>
                            <a href="#" class="nav-link text-gray-300 hover:text-white">Features</a>
                            <a href="#" class="nav-link text-gray-300 hover:text-white">Pricing</a>
                            <a href="#" class="nav-link text-gray-300 hover:text-white">About</a>
                            <a href="/swimming.html" class="nav-link text-gray-300 hover:text-white">Swimming</a>
</div>
                        
                        <div class="flex items-center space-x-4">
                            <button class="theme-toggle p-2 rounded-full bg-gray-800 text-gray-300 hover:bg-gray-700">
                                <i data-feather="moon"></i>
                            </button>
                            <a href="#" class="px-4 py-2 rounded-full bg-gradient-to-r from-primary to-secondary text-white font-medium hover:opacity-90 transition">
                                Get Started
                            </a>
                        </div>
                    </div>
                </div>
            </nav>
        `;
        
        // Add theme toggle functionality
        const themeToggle = this.shadowRoot.querySelector('.theme-toggle');
        themeToggle.addEventListener('click', () => {
            const isDark = document.documentElement.classList.contains('dark');
            if (isDark) {
                document.documentElement.classList.remove('dark');
                localStorage.setItem('theme', 'light');
                this.shadowRoot.querySelector('i[data-feather="moon"]').setAttribute('data-feather', 'sun');
            } else {
                document.documentElement.classList.add('dark');
                localStorage.setItem('theme', 'dark');
                this.shadowRoot.querySelector('i[data-feather="sun"]').setAttribute('data-feather', 'moon');
            }
            feather.replace();
        });
    }
}

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