File size: 2,603 Bytes
439a409 424fe85 439a409 424fe85 439a409 424fe85 439a409 |
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 |
class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
nav {
background: rgba(31, 41, 55, 0.8);
backdrop-filter: blur(10px);
border-bottom: 1px solid rgba(75, 85, 99, 0.5);
padding: 1rem;
position: sticky;
top: 0;
z-index: 40;
}
.nav-container {
max-width: 1200px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
display: flex;
align-items: center;
gap: 0.75rem;
font-weight: 700;
font-size: 1.25rem;
color: #fff;
text-decoration: none;
}
.logo i {
color: #60a5fa;
}
.nav-links {
display: flex;
gap: 1.5rem;
}
.nav-link {
color: #9ca3af;
text-decoration: none;
font-weight: 500;
transition: color 0.2s;
display: flex;
align-items: center;
gap: 0.5rem;
}
.nav-link:hover {
color: #fff;
}
.nav-link.active {
color: #60a5fa;
}
.nav-link.active i {
color: #60a5fa;
}
@media (max-width: 768px) {
.nav-container {
flex-direction: column;
gap: 1rem;
}
.nav-links {
flex-wrap: wrap;
justify-content: center;
}
}
</style>
<nav>
<div class="nav-container">
<a href="/" class="logo">
<i data-feather="radio"></i>
<span>ComSync Pro</span>
</a>
<div class="nav-links">
<a href="/" class="nav-link active">
<i data-feather="map"></i>
<span>Dashboard</span>
</a>
<a href="/chat.html" class="nav-link">
<i data-feather="message-circle"></i>
<span>AI Assistant</span>
</a>
</div>
</div>
</nav>
`;
// Load Feather icons
const script = document.createElement('script');
script.src = "https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js";
script.onload = () => {
setTimeout(() => {
if (this.shadowRoot) {
window.feather.replace();
}
}, 100);
};
this.shadowRoot.appendChild(script);
}
}
customElements.define('custom-navbar', CustomNavbar); |