class DocNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
// Add mobile menu toggle functionality
setTimeout(() => {
const toggle = this.shadowRoot.querySelector('[data-mobile-menu-toggle]');
const menu = this.shadowRoot.querySelector('[data-mobile-menu]');
if (toggle && menu) {
toggle.addEventListener('click', () => {
menu.classList.toggle('active');
});
}
// Replace feather icons
if (typeof feather !== 'undefined') {
feather.replace({
'stroke-width': 2,
'height': 24,
'width': 24
});
}
}, 100);
// Add scroll effect
window.addEventListener('scroll', () => {
const nav = this.shadowRoot.querySelector('nav');
if (window.scrollY > 50) {
nav.style.background = 'rgba(17, 24, 39, 0.95)';
nav.style.boxShadow = '0 4px 20px rgba(0, 0, 0, 0.3)';
} else {
nav.style.background = 'rgba(17, 24, 39, 0.8)';
nav.style.boxShadow = 'none';
}
});
}
}
customElements.define('doc-navbar', DocNavbar);