File size: 1,698 Bytes
7db63d2 | 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 | class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
nav {
background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.logo {
color: white;
font-weight: bold;
font-size: 1.25rem;
display: flex;
align-items: center;
}
.logo-icon {
margin-right: 0.5rem;
}
ul {
display: flex;
gap: 1.5rem;
list-style: none;
margin: 0;
padding: 0;
}
a {
color: white;
text-decoration: none;
transition: all 0.2s;
font-weight: 500;
padding: 0.5rem 0;
border-bottom: 2px solid transparent;
}
a:hover {
border-bottom-color: white;
}
@media (max-width: 768px) {
nav {
flex-direction: column;
padding: 1rem;
}
ul {
margin-top: 1rem;
}
}
</style>
<nav>
<div class="logo">
<i data-feather="zap" class="logo-icon"></i>
<span>SpeedyStack</span>
</div>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/api.html">API Docs</a></li>
<li><a href="/dashboard.html">Dashboard</a></li>
</ul>
</nav>
`;
}
}
customElements.define('custom-navbar', CustomNavbar); |