Spaces:
Running
Running
ficou muito simples quero algo na pegada top mesmo parrecido com o site oficial do nodejs, algo bem bonito, e limpo]
af0b858 verified | class CustomNavbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| width: 100%; | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| z-index: 1000; | |
| background-color: rgba(255, 255, 255, 0.98); | |
| box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08); | |
| backdrop-filter: blur(8px); | |
| -webkit-backdrop-filter: blur(8px); | |
| border-bottom: 1px solid rgba(0,0,0,0.05); | |
| } | |
| .container { | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| padding: 1rem 2rem; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| } | |
| .logo { | |
| font-size: 1.75rem; | |
| font-weight: 800; | |
| color: var(--primary); | |
| text-decoration: none; | |
| display: flex; | |
| align-items: center; | |
| transition: all 0.3s ease; | |
| } | |
| .logo:hover { | |
| opacity: 0.8; | |
| } | |
| .logo svg { | |
| width: 32px; | |
| height: 32px; | |
| margin-right: 10px; | |
| } | |
| .nav-links { | |
| display: flex; | |
| gap: 2rem; | |
| } | |
| .nav-links a { | |
| color: var(--dark); | |
| text-decoration: none; | |
| font-weight: 600; | |
| transition: all 0.3s ease; | |
| position: relative; | |
| padding: 0.5rem 0; | |
| } | |
| .nav-links a:hover { | |
| color: var(--primary); | |
| } | |
| .nav-links a.active { | |
| color: var(--primary); | |
| } | |
| .nav-links a.active::after { | |
| content: ''; | |
| position: absolute; | |
| bottom: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 3px; | |
| background: var(--gradient); | |
| border-radius: 3px; | |
| } | |
| .mobile-menu-btn { | |
| display: none; | |
| background: none; | |
| border: none; | |
| cursor: pointer; | |
| } | |
| @media (max-width: 768px) { | |
| .nav-links { | |
| display: none; | |
| flex-direction: column; | |
| position: absolute; | |
| top: 70px; | |
| left: 0; | |
| right: 0; | |
| background-color: white; | |
| padding: 2rem; | |
| box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1); | |
| } | |
| .nav-links.active { | |
| display: flex; | |
| } | |
| .mobile-menu-btn { | |
| display: block; | |
| } | |
| } | |
| </style> | |
| <div class="container"> | |
| <a href="/" class="logo"> | |
| <svg viewBox="0 0 24 24" fill="currentColor"> | |
| <path d="M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M12,20c-4.41,0-8-3.59-8-8s3.59-8,8-8s8,3.59,8,8S16.41,20,12,20z"/> | |
| <path d="M13,7h-2v5.414l3.293,3.293l1.414-1.414L13,11.586z"/> | |
| </svg> | |
| CodeCraft | |
| </a> | |
| <button class="mobile-menu-btn"> | |
| <i data-feather="menu"></i> | |
| </button> | |
| <div class="nav-links"> | |
| <a href="/" class="active">Início</a> | |
| <a href="#features">Recursos</a> | |
| <a href="#services">Serviços</a> | |
| <a href="#about">Sobre</a> | |
| <a href="#contact">Contato</a> | |
| </div> | |
| </div> | |
| `; | |
| // Mobile menu toggle | |
| const menuBtn = this.shadowRoot.querySelector('.mobile-menu-btn'); | |
| const navLinks = this.shadowRoot.querySelector('.nav-links'); | |
| menuBtn.addEventListener('click', () => { | |
| navLinks.classList.toggle('active'); | |
| feather.replace(); | |
| }); | |
| } | |
| } | |
| customElements.define('custom-navbar', CustomNavbar); |