| class CustomNavbar extends HTMLElement { |
| connectedCallback() { |
| this.attachShadow({ mode: 'open' }); |
| this.shadowRoot.innerHTML = ` |
| <style> |
| nav { |
| background: rgba(17, 24, 39, 0.95); |
| backdrop-filter: blur(10px); |
| padding: 1rem 2rem; |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| position: relative; |
| z-index: 50; |
| border-bottom: 1px solid rgba(255, 255, 255, 0.1); |
| } |
| .logo { |
| color: white; |
| font-weight: bold; |
| font-size: 1.5rem; |
| background: linear-gradient(45deg, #8b5cf6, #3b82f6); |
| background-clip: text; |
| -webkit-background-clip: text; |
| -webkit-text-fill-color: transparent; |
| } |
| ul { |
| display: flex; |
| gap: 2rem; |
| list-style: none; |
| margin: 0; |
| padding: 0; |
| } |
| a { |
| color: white; |
| text-decoration: none; |
| transition: all 0.3s ease; |
| font-weight: 500; |
| } |
| a:hover { |
| color: #8b5cf6; |
| transform: translateY(-2px); |
| } |
| .mobile-menu-btn { |
| display: none; |
| background: none; |
| border: none; |
| color: white; |
| cursor: pointer; |
| } |
| @media (max-width: 768px) { |
| ul { |
| display: none; |
| position: absolute; |
| top: 100%; |
| left: 0; |
| right: 0; |
| background: rgba(17, 24, 39, 0.98); |
| flex-direction: column; |
| padding: 1rem; |
| gap: 1rem; |
| } |
| ul.show { |
| display: flex; |
| } |
| .mobile-menu-btn { |
| display: block; |
| } |
| } |
| </style> |
| <nav> |
| <div class="logo">UnityLeadCapture 🎮</div> |
| <button class="mobile-menu-btn"> |
| <i data-feather="menu"></i> |
| </button> |
| <ul> |
| <li><a href="/">Home</a></li> |
| <li><a href="/vagas.html">Vagas</a></li> |
| <li><a href="/sobre.html">Sobre</a></li> |
| <li><a href="/contato.html">Contato</a></li> |
| </ul> |
| </nav> |
| `; |
|
|
| |
| const mobileMenuBtn = this.shadowRoot.querySelector('.mobile-menu-btn'); |
| const menu = this.shadowRoot.querySelector('ul'); |
|
|
| mobileMenuBtn.addEventListener('click', () => { |
| menu.classList.toggle('show'); |
| feather.replace(); |
| }); |
|
|
| |
| document.addEventListener('click', (e) => { |
| if (!this.contains(e.target) && menu.classList.contains('show')) { |
| menu.classList.remove('show'); |
| } |
| }); |
| } |
| } |
|
|
| customElements.define('custom-navbar', CustomNavbar); |