Spaces:
Running
Running
File size: 3,110 Bytes
eb1b2ee 235883a cdf1999 3e8b914 eb1b2ee cdf1999 eb1b2ee |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
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); |