|
|
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> |
|
|
`; |
|
|
|
|
|
|
|
|
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); |