SherlockRamos's picture
Go
e133568 verified
class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
width: 100%;
position: sticky;
top: 0;
z-index: 50;
background-color: white;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.navbar-container {
max-width: 1280px;
margin: 0 auto;
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-weight: 700;
font-size: 1.5rem;
color: var(--primary-600);
display: flex;
align-items: center;
gap: 0.5rem;
}
.nav-links {
display: flex;
gap: 1.5rem;
}
.nav-link {
color: var(--gray-600);
font-weight: 500;
transition: color 0.2s;
}
.nav-link:hover {
color: var(--primary-600);
}
.mobile-menu-btn {
display: none;
background: none;
border: none;
cursor: pointer;
}
@media (max-width: 768px) {
.mobile-menu-btn {
display: block;
}
.nav-links {
display: none;
}
}
</style>
<div class="navbar-container">
<a href="/" class="logo">
<span>Chromatic Canvas</span>
</a>
<div class="nav-links">
<a href="/" class="nav-link">Home</a>
<a href="/features" class="nav-link">Features</a>
<a href="/gallery" class="nav-link">Gallery</a>
<a href="/contact" class="nav-link">Contact</a>
</div>
<button class="mobile-menu-btn">
<i data-feather="menu"></i>
</button>
</div>
`;
}
}
customElements.define('custom-navbar', CustomNavbar);