-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-header.html
More file actions
452 lines (391 loc) · 15.9 KB
/
test-header.html
File metadata and controls
452 lines (391 loc) · 15.9 KB
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MainWP.dev Header Test</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
/* Base colors */
--color-primary: #7fb100;
--color-secondary: #446200;
--color-accent: #4682b4;
--color-text: #1c1d1b;
--color-text-muted: #666;
--color-background: #f2f3f2;
--color-border: #e2e3e2;
--color-code-background: #f8f9f8;
--color-link: var(--color-accent);
--color-link-hover: #446200;
/* Layout */
--dox-border-radius: 4px;
--dox-z-index-header: 1000;
--dox-transition-base: all 0.2s ease-in-out;
}
/* Dark mode colors */
.dark-mode {
--color-text: #f2f3f2;
--color-text-muted: #aaa;
--color-background: #1c1d1b;
--color-border: #2d2e2c;
--color-code-background: #2a2b29;
--color-link: #7fb100;
--color-link-hover: #9fd320;
}
/* Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
line-height: 1.6;
color: var(--color-text);
background-color: var(--color-background);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transition: background-color 0.3s ease, color 0.3s ease;
}
/* Container */
.o-container {
max-width: 1200px;
margin: 0 auto;
padding: 0 1rem;
}
/* Header styles */
.c-header {
position: sticky;
top: 0;
z-index: var(--dox-z-index-header);
padding: 1rem 0;
background-color: var(--color-background);
border-bottom: 1px solid var(--color-border);
transition: background-color 0.3s ease, border-color 0.3s ease;
}
.c-header__inner {
display: flex;
align-items: center;
justify-content: space-between;
height: 3rem;
}
/* Logo */
.c-logo {
display: inline-flex;
align-items: center;
text-decoration: none;
transition: opacity 0.2s ease;
}
.c-logo:hover {
opacity: 0.9;
}
.c-logo__text {
display: flex;
align-items: baseline;
font-size: 1.5rem;
font-weight: 700;
line-height: 1;
}
.c-logo__text--main {
color: var(--color-primary);
}
.c-logo__text--wp {
color: var(--color-text);
}
.c-logo__text--dev {
font-size: 1rem;
color: var(--color-text);
opacity: 0.7;
margin-left: 0.25rem;
}
/* Navigation */
.c-nav {
margin: 0 2rem;
}
.c-nav__list {
display: flex;
list-style: none;
margin: 0;
padding: 0;
gap: 2rem;
}
.c-nav__link {
color: var(--color-text);
text-decoration: none;
font-weight: 500;
font-size: 0.9375rem;
transition: color 0.2s ease;
}
.c-nav__link:hover {
color: var(--color-primary);
}
/* Header Actions */
.c-header__actions {
display: flex;
align-items: center;
gap: 1rem;
}
.c-theme-toggle {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 2.5rem;
height: 2.5rem;
padding: 0;
border: none;
border-radius: 50%;
background: transparent;
color: var(--color-text);
cursor: pointer;
transition: background-color 0.2s ease;
}
.c-theme-toggle:hover {
background-color: var(--color-border);
}
.c-theme-toggle:focus {
outline: none;
box-shadow: 0 0 0 2px var(--color-primary);
}
.c-theme-toggle__icon {
position: absolute;
transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
}
.c-theme-toggle__icon--light {
opacity: 0;
transform: rotate(-90deg) scale(0);
}
.dark-mode .c-theme-toggle__icon--light {
opacity: 1;
transform: rotate(0) scale(1);
}
.c-theme-toggle__icon--dark {
opacity: 1;
transform: rotate(0) scale(1);
}
.dark-mode .c-theme-toggle__icon--dark {
opacity: 0;
transform: rotate(90deg) scale(0);
}
.c-header__github {
display: inline-flex;
align-items: center;
justify-content: center;
width: 2.5rem;
height: 2.5rem;
color: var(--color-text);
border-radius: 50%;
transition: background-color 0.2s ease, color 0.2s ease;
}
.c-header__github:hover {
background-color: var(--color-border);
color: var(--color-primary);
}
/* Mobile Navigation */
.c-nav-trigger {
display: none;
padding: 0.5rem;
border: none;
background: none;
cursor: pointer;
color: var(--color-text);
}
.c-nav-trigger:focus {
outline: none;
}
.c-nav-trigger__icon {
position: relative;
display: block;
width: 24px;
height: 2px;
background-color: currentColor;
transition: background-color 0.2s ease;
}
.c-nav-trigger__icon::before,
.c-nav-trigger__icon::after {
content: '';
position: absolute;
left: 0;
width: 100%;
height: 2px;
background-color: currentColor;
transition: transform 0.2s ease;
}
.c-nav-trigger__icon::before {
top: -6px;
}
.c-nav-trigger__icon::after {
bottom: -6px;
}
.js-nav-trigger.is-active .c-nav-trigger__icon {
background-color: transparent;
}
.js-nav-trigger.is-active .c-nav-trigger__icon::before {
transform: translateY(6px) rotate(45deg);
}
.js-nav-trigger.is-active .c-nav-trigger__icon::after {
transform: translateY(-6px) rotate(-45deg);
}
@media (max-width: 768px) {
.c-nav-trigger {
display: block;
}
.c-nav-wrap {
display: none;
position: absolute;
top: 100%;
left: 0;
right: 0;
background-color: var(--color-background);
border-bottom: 1px solid var(--color-border);
padding: 1rem;
}
.c-nav-wrap.is-active {
display: block;
}
.c-nav {
margin: 0;
}
.c-nav__list {
flex-direction: column;
gap: 1rem;
}
.c-nav__link {
display: block;
padding: 0.5rem 0;
}
.c-header__github {
display: none;
}
}
/* Test content */
.test-content {
padding: 2rem;
text-align: center;
}
</style>
</head>
<body>
<header class="c-header">
<div class="o-container">
<div class="c-header__inner">
<div class="c-header__brand">
<a href="/" class="c-logo">
<span class="c-logo__text">
<span class="c-logo__text--main">Main</span><span class="c-logo__text--wp">WP</span>
<span class="c-logo__text--dev">.dev</span>
</span>
</a>
</div>
<button class="c-nav-trigger js-nav-trigger" aria-label="Toggle navigation">
<span class="c-nav-trigger__icon"></span>
</button>
<div class="c-nav-wrap">
<nav class="c-nav" role="navigation">
<ul class="c-nav__list">
<li class="c-nav__item">
<a class="c-nav__link" href="/documentation">Documentation</a>
</li>
<li class="c-nav__item">
<a class="c-nav__link" href="/guides">Guides</a>
</li>
<li class="c-nav__item">
<a class="c-nav__link" href="/hooks">Hooks</a>
</li>
<li class="c-nav__item">
<a class="c-nav__link" href="/api">API</a>
</li>
</ul>
</nav>
</div>
<div class="c-header__actions">
<button class="c-theme-toggle js-theme-toggle" aria-label="Toggle theme">
<svg class="c-theme-toggle__icon c-theme-toggle__icon--light" width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 3V4M12 20V21M4 12H3M6.31412 6.31412L5.5 5.5M17.6859 6.31412L18.5 5.5M6.31412 17.69L5.5 18.5M17.6859 17.69L18.5 18.5M21 12H20M16 12C16 14.2091 14.2091 16 12 16C9.79086 16 8 14.2091 8 12C8 9.79086 9.79086 8 12 8C14.2091 8 16 9.79086 16 12Z" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg>
<svg class="c-theme-toggle__icon c-theme-toggle__icon--dark" width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M22 15.8442C20.6866 16.4382 19.2286 16.7688 17.6935 16.7688C11.9153 16.7688 7.23116 12.0847 7.23116 6.30654C7.23116 4.77135 7.5618 3.31341 8.15577 2C3.52576 3.64163 0.1 8.20902 0.1 13.5377C0.1 19.3159 4.78414 24 10.5623 24C15.891 24 20.4584 20.5742 22.1 15.9442" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
</svg>
</button>
<a href="https://github.com/mainwp" class="c-header__github" target="_blank" rel="noopener noreferrer" aria-label="MainWP on GitHub">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2C6.475 2 2 6.475 2 12C2 16.425 4.8625 20.1625 8.8375 21.4875C9.3375 21.575 9.525 21.275 9.525 21.0125C9.525 20.775 9.5125 19.9875 9.5125 19.15C7 19.6125 6.35 18.5375 6.15 17.975C6.0375 17.6875 5.55 16.8 5.125 16.5625C4.775 16.375 4.275 15.9125 5.1125 15.9C5.9 15.8875 6.4625 16.625 6.65 16.925C7.55 18.4375 8.9875 18.0125 9.5625 17.75C9.65 17.1 9.9125 16.6625 10.2 16.4125C7.975 16.1625 5.65 15.3 5.65 11.475C5.65 10.3875 6.0375 9.4875 6.675 8.7875C6.575 8.5375 6.225 7.5125 6.775 6.1375C6.775 6.1375 7.6125 5.875 9.525 7.1625C10.325 6.9375 11.175 6.825 12.025 6.825C12.875 6.825 13.725 6.9375 14.525 7.1625C16.4375 5.8625 17.275 6.1375 17.275 6.1375C17.825 7.5125 17.475 8.5375 17.375 8.7875C18.0125 9.4875 18.4 10.375 18.4 11.475C18.4 15.3125 16.0625 16.1625 13.8375 16.4125C14.2 16.725 14.5125 17.325 14.5125 18.2625C14.5125 19.6 14.5 20.675 14.5 21.0125C14.5 21.275 14.6875 21.5875 15.1875 21.4875C19.1375 20.1625 22 16.4125 22 12C22 6.475 17.525 2 12 2Z" fill="currentColor"/>
</svg>
</a>
</div>
</div>
</div>
</header>
<div class="test-content">
<h1>MainWP.dev Documentation</h1>
<p>This is a test page to verify the header implementation and theme toggle functionality.</p>
</div>
<script>
// Theme Toggle functionality
document.addEventListener('DOMContentLoaded', function() {
const themeToggle = document.querySelector('.js-theme-toggle');
const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)');
// Function to set theme
function setTheme(theme) {
document.documentElement.classList.remove('light-mode', 'dark-mode');
document.documentElement.classList.add(theme + '-mode');
localStorage.setItem('theme', theme);
}
// Initialize theme
const savedTheme = localStorage.getItem('theme') ||
(prefersDarkScheme.matches ? 'dark' : 'light');
setTheme(savedTheme);
// Toggle theme on button click
themeToggle.addEventListener('click', () => {
const currentTheme = localStorage.getItem('theme') ||
(prefersDarkScheme.matches ? 'dark' : 'light');
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
setTheme(newTheme);
});
// Handle system theme changes
prefersDarkScheme.addEventListener('change', (e) => {
const savedTheme = localStorage.getItem('theme');
if (!savedTheme) {
setTheme(e.matches ? 'dark' : 'light');
}
});
});
// Mobile Navigation functionality
document.addEventListener('DOMContentLoaded', function() {
const navTrigger = document.querySelector('.js-nav-trigger');
const navWrap = document.querySelector('.c-nav-wrap');
if (navTrigger && navWrap) {
navTrigger.addEventListener('click', function() {
const isExpanded = this.getAttribute('aria-expanded') === 'true';
this.setAttribute('aria-expanded', !isExpanded);
this.classList.toggle('is-active');
navWrap.classList.toggle('is-active');
// Prevent body scroll when menu is open
document.body.style.overflow = isExpanded ? '' : 'hidden';
});
// Close menu on window resize
window.addEventListener('resize', function() {
if (window.innerWidth > 768) {
navTrigger.classList.remove('is-active');
navWrap.classList.remove('is-active');
navTrigger.setAttribute('aria-expanded', 'false');
document.body.style.overflow = '';
}
});
// Close menu when clicking outside
document.addEventListener('click', function(event) {
const isClickInside = navWrap.contains(event.target) ||
navTrigger.contains(event.target);
if (!isClickInside && navWrap.classList.contains('is-active')) {
navTrigger.classList.remove('is-active');
navWrap.classList.remove('is-active');
navTrigger.setAttribute('aria-expanded', 'false');
document.body.style.overflow = '';
}
});
}
});
</script>
</body>
</html>