Spaces:
Running
Running
File size: 4,800 Bytes
2d1d74f | 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 | class CustomHeader extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
height: 64px;
background-color: #0a0a0a;
border-bottom: 1px solid #333333;
position: sticky;
top: 0;
z-index: 50;
font-family: 'JetBrains Mono', monospace;
}
.container {
max-width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 1.5rem;
}
.logo {
font-weight: 700;
font-size: 1.125rem;
color: #e5e5e5;
display: flex;
align-items: center;
gap: 0.5rem;
text-decoration: none;
}
.logo:hover {
color: #ff6600;
}
.nav-links {
display: flex;
align-items: center;
gap: 2rem;
}
.nav-item {
font-size: 0.875rem;
color: #888888;
text-decoration: none;
transition: color 0.2s;
}
.nav-item:hover, .nav-item.active {
color: #e5e5e5;
}
.search-box {
display: flex;
align-items: center;
background-color: #111111;
border: 1px solid #333333;
padding: 0.25rem 0.75rem;
border-radius: 4px;
font-size: 0.875rem;
color: #888888;
width: 200px;
}
.search-box input {
background: transparent;
border: none;
outline: none;
color: #e5e5e5;
width: 100%;
margin-left: 0.5rem;
font-family: 'JetBrains Mono', monospace;
}
.search-icon {
width: 16px;
height: 16px;
color: #888888;
}
/* Mobile Menu Button */
.menu-btn {
display: none;
background: none;
border: none;
color: #e5e5e5;
cursor: pointer;
}
@media (max-width: 768px) {
.nav-links {
display: none;
}
.search-box {
display: none;
}
.menu-btn {
display: block;
}
}
</style>
<div class="container">
<a href="/" class="logo">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-accent"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>
Syncopated Notes
</a>
<div class="search-box">
<i data-feather="search" class="search-icon"></i>
<input type="text" placeholder="Search...">
</div>
<nav class="nav-links">
<a href="#" class="nav-item active">Docs</a>
<a href="#" class="nav-item">Blog</a>
<a href="#" class="nav-item">About</a>
<a href="https://github.com" target="_blank" class="nav-item">
<i data-feather="github" style="width:18px;height:18px;"></i>
</a>
</nav>
<button class="menu-btn">
<i data-feather="menu"></i>
</button>
</div>
`;
// Initialize icons inside shadow DOM
if (window.feather) {
window.feather.replace();
}
}
}
customElements.define('custom-header', CustomHeader); |