Spaces:
Running
Running
File size: 9,123 Bytes
0263b48 | 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 | class HeaderComponent extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
background: linear-gradient(135deg, rgb(17 24 39), rgb(31 41 55));
border-bottom: 1px solid rgb(55 65 81);
padding: 1rem 0;
position: sticky;
top: 0;
z-index: 100;
backdrop-filter: blur(10px);
}
.container {
max-width: 1280px;
margin: 0 auto;
padding: 0 1rem;
}
nav {
display: flex;
align-items: center;
justify-content: space-between;
}
.nav-brand {
display: flex;
align-items: center;
text-decoration: none;
color: white;
font-size: 1.25rem;
font-weight: bold;
}
.nav-brand svg {
margin-right: 0.5rem;
color: rgb(249 115 22);
}
.nav-links {
display: flex;
align-items: center;
gap: 2rem;
}
.nav-link {
color: rgb(209 213 219);
text-decoration: none;
font-size: 0.875rem;
font-weight: 500;
transition: color 0.2s ease;
position: relative;
}
.nav-link:hover {
color: rgb(249 115 22);
}
.nav-link.active {
color: rgb(249 115 22);
}
.nav-link.active::after {
content: '';
position: absolute;
bottom: -1.5rem;
left: 0;
right: 0;
height: 2px;
background: rgb(249 115 22);
}
.nav-actions {
display: flex;
align-items: center;
gap: 1rem;
}
.btn-icon {
background: none;
border: none;
color: rgb(156 163 175);
padding: 0.5rem;
border-radius: 0.5rem;
cursor: pointer;
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
}
.btn-icon:hover {
background: rgb(55 65 81);
color: rgb(249 115 22);
}
.btn-primary {
background: linear-gradient(135deg, rgb(249 115 22), rgb(234 88 12));
color: white;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
font-weight: 500;
text-decoration: none;
display: flex;
align-items: center;
transition: all 0.2s ease;
}
.btn-primary:hover {
background: linear-gradient(135deg, rgb(234 88 12), rgb(194 65 12));
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}
.user-menu {
position: relative;
}
.user-avatar {
width: 2rem;
height: 2rem;
border-radius: 50%;
background: linear-gradient(135deg, rgb(249 115 22), rgb(59 130 246));
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: bold;
cursor: pointer;
}
.notification-badge {
position: absolute;
top: -0.25rem;
right: -0.25rem;
width: 0.75rem;
height: 0.75rem;
background: rgb(239 68 68);
border-radius: 50%;
border: 2px solid rgb(17 24 39);
}
.mobile-menu-toggle {
display: none;
background: none;
border: none;
color: white;
padding: 0.5rem;
cursor: pointer;
}
@media (max-width: 768px) {
.nav-links {
display: none;
}
.nav-actions {
gap: 0.5rem;
}
.mobile-menu-toggle {
display: block;
}
}
</style>
<header>
<div class="container">
<nav>
<a href="#" class="nav-brand">
<i data-feather="search"></i>
Skip Trace Pro
</a>
<div class="nav-links">
<a href="#" class="nav-link active">Dashboard</a>
<a href="#" class="nav-link">Cases</a>
<a href="#" class="nav-link">Analytics</a>
<a href="#" class="nav-link">Reports</a>
<a href="#" class="nav-link">Settings</a>
</div>
<div class="nav-actions">
<button class="btn-icon" onclick="toggleNotifications()">
<i data-feather="bell"></i>
<span class="notification-badge"></span>
</button>
<button class="btn-icon" onclick="toggleTheme()">
<i data-feather="moon"></i>
</button>
<a href="#" class="btn-primary">
<i data-feather="plus" style="width: 16px; height: 16px; margin-right: 0.5rem;"></i>
New Search
</a>
<div class="user-menu">
<div class="user-avatar">JD</div>
</div>
<button class="mobile-menu-toggle" onclick="toggleMobileMenu()">
<i data-feather="menu"></i>
</button>
</div>
</nav>
</div>
</header>
`;
// Add event listeners
this.shadowRoot.querySelectorAll('.nav-link').forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
this.setActiveLink(e.target);
});
});
}
setActiveLink(activeLink) {
this.shadowRoot.querySelectorAll('.nav-link').forEach(link => {
link.classList.remove('active');
});
activeLink.classList.add('active');
}
}
customElements.define('header-component', HeaderComponent);
// Global functions for the header
function toggleNotifications() {
// Toggle notifications dropdown
console.log('Toggle notifications');
showNotification('You have 3 new notifications', 'info');
}
function toggleTheme() {
// Toggle between light and dark mode
const html = document.documentElement;
const isDark = html.classList.contains('dark');
if (isDark) {
html.classList.remove('dark');
localStorage.setItem('theme', 'light');
} else {
html.classList.add('dark');
localStorage.setItem('theme', 'dark');
}
showNotification(`Switched to ${isDark ? 'light' : 'dark'} mode`, 'info');
}
function toggleMobileMenu() {
// Toggle mobile menu
console.log('Toggle mobile menu');
} |