Spaces:
Running
Running
Download components/navbar.js from CSNET/salesflow-dashboard: direct link, hf CLI and curl.
- Browser
- Download file 5.91 kB
-
https://huggingface.co/spaces/CSNET/salesflow-dashboard/resolve/main/components/navbar.js
- Command line
-
hf download hf://spaces/CSNET/salesflow-dashboard/components/navbar.js
-
curl -L -o navbar.js https://huggingface.co/spaces/CSNET/salesflow-dashboard/resolve/main/components/navbar.js
5.91 kB
| class CustomNavbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| * { | |
| box-sizing: border-box; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| nav { | |
| background: linear-gradient(135deg, #10b981 0%, #059669 100%); | |
| box-shadow: 0 2px 4px rgba(0,0,0,0.1); | |
| } | |
| .nav-container { | |
| max-width: 1280px; | |
| margin: 0 auto; | |
| padding: 1rem 2rem; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| } | |
| .logo { | |
| display: flex; | |
| align-items: center; | |
| gap: 0.75rem; | |
| color: white; | |
| font-size: 1.25rem; | |
| font-weight: 700; | |
| text-decoration: none; | |
| } | |
| .nav-menu { | |
| display: flex; | |
| gap: 2rem; | |
| list-style: none; | |
| } | |
| .nav-link { | |
| color: rgba(255, 255, 255, 0.9); | |
| text-decoration: none; | |
| font-size: 0.95rem; | |
| font-weight: 500; | |
| padding: 0.5rem 0; | |
| transition: color 0.2s; | |
| position: relative; | |
| } | |
| .nav-link:hover, | |
| .nav-link.active { | |
| color: white; | |
| } | |
| .nav-link.active::after { | |
| content: ''; | |
| position: absolute; | |
| bottom: -4px; | |
| left: 0; | |
| right: 0; | |
| height: 2px; | |
| background: #eab308; | |
| border-radius: 1px; | |
| } | |
| .user-menu { | |
| display: flex; | |
| align-items: center; | |
| gap: 1rem; | |
| } | |
| .notification-btn { | |
| background: rgba(255, 255, 255, 0.1); | |
| border: none; | |
| padding: 0.5rem; | |
| border-radius: 0.5rem; | |
| color: white; | |
| cursor: pointer; | |
| transition: background 0.2s; | |
| position: relative; | |
| } | |
| .notification-btn:hover { | |
| background: rgba(255, 255, 255, 0.2); | |
| } | |
| .notification-badge { | |
| position: absolute; | |
| top: -2px; | |
| right: -2px; | |
| background: #eab308; | |
| color: #1f2937; | |
| width: 18px; | |
| height: 18px; | |
| border-radius: 50%; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| font-size: 0.7rem; | |
| font-weight: 700; | |
| } | |
| .user-avatar { | |
| width: 36px; | |
| height: 36px; | |
| border-radius: 50%; | |
| background: rgba(255, 255, 255, 0.2); | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| color: white; | |
| font-weight: 600; | |
| } | |
| @media (max-width: 768px) { | |
| .nav-container { | |
| padding: 1rem; | |
| } | |
| .nav-menu { | |
| display: none; | |
| } | |
| } | |
| </style> | |
| <nav> | |
| <div class="nav-container"> | |
| <a href="#" class="logo"> | |
| <i data-feather="trending-up" style="width: 24px; height: 24px;"></i> | |
| SalesFlow | |
| </a> | |
| <ul class="nav-menu"> | |
| <li><a href="#" class="nav-link active">แดชบอร์ด</a></li> | |
| <li><a href="#" class="nav-link">รายงาน</a></li> | |
| <li><a href="#" class="nav-link">สินค้า</a></li> | |
| <li><a href="#" class="nav-link">ลูกค้า</a></li> | |
| <li><a href="#" class="nav-link">การตั้งค่า</a></li> | |
| </ul> | |
| <div class="user-menu"> | |
| <button class="notification-btn"> | |
| <i data-feather="bell" style="width: 20px; height: 20px;"></i> | |
| <span class="notification-badge">3</span> | |
| </button> | |
| <div class="user-avatar">AD</div> | |
| </div> | |
| </div> | |
| </nav> | |
| `; | |
| // Initialize Feather Icons inside Shadow DOM | |
| const icons = this.shadowRoot.querySelectorAll('[data-feather]'); | |
| icons.forEach(icon => { | |
| const iconName = icon.getAttribute('data-feather'); | |
| icon.outerHTML = feather.icons[iconName].toSvg({ | |
| width: icon.style.width || '24', | |
| height: icon.style.height || '24' | |
| }); | |
| }); | |
| } | |
| } | |
| customElements.define('custom-navbar', CustomNavbar); |