File size: 10,214 Bytes
42538c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
class CustomHeader extends HTMLElement {
    constructor() {
        super();
    }

    connectedCallback() {
        this.attachShadow({ mode: 'open' });
        this.shadowRoot.innerHTML = `
            <style>
                :host {
                    display: block;
                    width: 100%;
                }
                
                .header-container {
                    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 27, 75, 0.8) 100%);
                    backdrop-filter: blur(10px);
                    border-bottom: 1px solid rgba(14, 165, 233, 0.2);
                    position: sticky;
                    top: 0;
                    z-index: 100;
                }
                
                .header-content {
                    max-width: 1280px;
                    margin: 0 auto;
                    padding: 1rem 2rem;
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                }
                
                .logo {
                    display: flex;
                    align-items: center;
                    gap: 0.75rem;
                    text-decoration: none;
                }
                
                .logo-icon {
                    width: 2.5rem;
                    height: 2.5rem;
                    background: linear-gradient(45deg, #0ea5e9, #ec4899);
                    border-radius: 12px;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    transform: rotate(-5deg);
                    transition: transform 0.3s ease;
                }
                
                .logo:hover .logo-icon {
                    transform: rotate(0deg) scale(1.1);
                }
                
                .logo-text {
                    background: linear-gradient(to right, #7dd3fc, #f472b6);
                    -webkit-background-clip: text;
                    background-clip: text;
                    color: transparent;
                    font-weight: 800;
                    font-size: 1.5rem;
                    letter-spacing: -0.5px;
                }
                
                .nav-links {
                    display: flex;
                    gap: 2rem;
                    align-items: center;
                }
                
                .nav-link {
                    color: #cbd5e1;
                    text-decoration: none;
                    font-weight: 500;
                    padding: 0.5rem 1rem;
                    border-radius: 8px;
                    transition: all 0.3s ease;
                    position: relative;
                }
                
                .nav-link:hover {
                    color: white;
                    background: rgba(14, 165, 233, 0.1);
                }
                
                .nav-link.active {
                    color: white;
                    background: linear-gradient(90deg, rgba(14, 165, 233, 0.2), rgba(236, 72, 153, 0.2));
                }
                
                .nav-link.active::after {
                    content: '';
                    position: absolute;
                    bottom: -2px;
                    left: 1rem;
                    right: 1rem;
                    height: 2px;
                    background: linear-gradient(90deg, #0ea5e9, #ec4899);
                    border-radius: 1px;
                }
                
                .mobile-menu-btn {
                    display: none;
                    background: none;
                    border: none;
                    color: #cbd5e1;
                    cursor: pointer;
                    padding: 0.5rem;
                    border-radius: 8px;
                    transition: background 0.3s ease;
                }
                
                .mobile-menu-btn:hover {
                    background: rgba(255, 255, 255, 0.1);
                }
                
                @media (max-width: 768px) {
                    .header-content {
                        padding: 1rem;
                    }
                    
                    .nav-links {
                        display: none;
                    }
                    
                    .mobile-menu-btn {
                        display: block;
                    }
                    
                    .mobile-menu {
                        display: none;
                        position: absolute;
                        top: 100%;
                        left: 0;
                        right: 0;
                        background: rgba(15, 23, 42, 0.95);
                        backdrop-filter: blur(10px);
                        border-bottom: 1px solid rgba(14, 165, 233, 0.2);
                        padding: 1rem;
                        flex-direction: column;
                        gap: 0.5rem;
                    }
                    
                    .mobile-menu.active {
                        display: flex;
                    }
                    
                    .mobile-nav-link {
                        color: #cbd5e1;
                        text-decoration: none;
                        padding: 0.75rem 1rem;
                        border-radius: 8px;
                        transition: all 0.3s ease;
                    }
                    
                    .mobile-nav-link:hover {
                        color: white;
                        background: rgba(14, 165, 233, 0.1);
                    }
                }
            </style>
            
            <header class="header-container">
                <div class="header-content">
                    <a href="/" class="logo">
                        <div class="logo-icon">
                            <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                <path d="M12 2L2 7L12 12L22 7L12 2Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                <path d="M2 17L12 22L22 17" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                <path d="M2 12L12 17L22 12" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                            </svg>
                        </div>
                        <span class="logo-text">TESTCOMIX</span>
                    </a>
                    
                    <nav class="nav-links">
                        <a href="/" class="nav-link active">
                            <i data-feather="home" width="16" height="16" style="vertical-align: text-bottom; margin-right: 6px;"></i>
                            Home
                        </a>
                        <a href="/gallery" class="nav-link">
                            <i data-feather="image" width="16" height="16" style="vertical-align: text-bottom; margin-right: 6px;"></i>
                            Gallery
                        </a>
                        <a href="/create" class="nav-link">
                            <i data-feather="edit-3" width="16" height="16" style="vertical-align: text-bottom; margin-right: 6px;"></i>
                            Create
                        </a>
                        <a href="/about" class="nav-link">
                            <i data-feather="info" width="16" height="16" style="vertical-align: text-bottom; margin-right: 6px;"></i>
                            About
                        </a>
                        <a href="/contact" class="nav-link">
                            <i data-feather="mail" width="16" height="16" style="vertical-align: text-bottom; margin-right: 6px;"></i>
                            Contact
                        </a>
                    </nav>
                    
                    <button class="mobile-menu-btn" id="mobileMenuBtn">
                        <i data-feather="menu" width="24" height="24"></i>
                    </button>
                </div>
                
                <div class="mobile-menu" id="mobileMenu">
                    <a href="/" class="mobile-nav-link active">
                        <i data-feather="home" width="16" height="16" style="vertical-align: text-bottom; margin-right: 8px;"></i>
                        Home
                    </a>
                    <a href="/gallery" class="mobile-nav-link">
                        <i data-feather="image" width="16" height="16" style="vertical-align: text-bottom; margin-right: 8px;"></i>
                        Gallery
                    </a>
                    <a href="/create" class="mobile-nav-link">
                        <i data-feather="edit-3" width="16" height="16" style="vertical-align: text-bottom; margin-right: 8px;"></i>
                        Create
                    </a>
                    <a href="/about" class="mobile-nav-link">
                        <i data-feather="info" width="16" height="16" style="vertical-align: text-bottom; margin-right: 8px;"></i>
                        About
                    </a>
                    <a href="/contact" class="mobile-nav-link">
                        <i data-feather="mail" width="16" height="16" style="vertical-align: text-bottom; margin-right: 8px;"></i>
                        Contact
                    </a>
                </div>
            </header>
        `;
        
        // Add event listener for mobile menu
        this.shadowRoot.getElementById('mobileMenuBtn').addEventListener('click', () => {
            const menu = this.shadowRoot.getElementById('mobileMenu');
            menu.classList.toggle('active');
        });
        
        // Replace feather icons after component is attached
        if (window.feather) {
            window.feather.replace();
        } else {
            window.addEventListener('feather-icons-loaded', () => {
                window.feather.replace();
            });
        }
    }
}

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