hts-ai's picture
accé gihub
3e8b914 verified
class CustomNavbar extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
background: #1f2937;
border-bottom: 2px solid #ef4444;
}
.navbar {
max-width: 1280px;
margin: 0 auto;
padding: 1rem 1.5rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.25rem;
font-weight: 700;
color: white;
text-decoration: none;
}
.logo-icon {
color: #ef4444;
width: 28px;
height: 28px;
}
.nav-links {
display: flex;
gap: 2rem;
list-style: none;
margin: 0;
padding: 0;
}
.nav-links a {
color: #d1d5db;
text-decoration: none;
font-weight: 500;
transition: color 0.2s;
position: relative;
}
.nav-links a:hover {
color: #ef4444;
}
.nav-links a.active::after {
content: '';
position: absolute;
bottom: -4px;
left: 0;
width: 100%;
height: 2px;
background: #ef4444;
}
@media (max-width: 768px) {
.nav-links {
gap: 1rem;
}
.nav-links a {
font-size: 0.9rem;
}
}
</style>
<nav class="navbar" role="navigation" aria-label="Main navigation">
<a href="/" class="logo" aria-label="Janus Scanner Pro Home">
<svg class="logo-icon" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/>
</svg>
Janus Scanner Pro
</a>
<ul class="nav-links">
<li><a href="/" data-page="dashboard">Dashboard</a></li>
<li><a href="full-fraud-detection.html" data-page="full-fraud-detection">Full Detection</a></li>
<li><a href="pages/reports.html" data-page="reports">Reports</a></li>
<li><a href="pages/settings.html" data-page="settings">Settings</a></li>
<li><a href="https://github.com/janus-scanner-pro" target="_blank">GitHub</a></li>
</ul>
</nav>
`;
// Gestion de la route active
const currentPage = window.location.pathname.split('/').pop() || 'dashboard';
this.shadowRoot.querySelectorAll('.nav-links a').forEach(link => {
if (link.dataset.page === currentPage || (currentPage === '' && link.dataset.page === 'dashboard')) {
link.classList.add('active');
}
});
}
}
customElements.define('custom-navbar', CustomNavbar);