jfgrilmaffre's picture
je veux un site web qui permet d'accéder aux datasheets de produits semiconducteur de la société microchip. la page principale présentera un systeme de selection ( famille, type ... ) .
3c90fc7 verified
class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
width: 100%;
background-color: white;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
position: sticky;
top: 0;
z-index: 50;
}
nav {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 2rem;
max-width: 1440px;
margin: 0 auto;
}
.logo {
display: flex;
align-items: center;
text-decoration: none;
font-weight: 700;
font-size: 1.25rem;
color: #1e40af;
}
.logo-icon {
margin-right: 0.5rem;
}
.nav-links {
display: flex;
gap: 1.5rem;
}
.nav-link {
text-decoration: none;
color: #4b5563;
font-weight: 500;
transition: color 0.2s;
padding: 0.5rem 0;
position: relative;
}
.nav-link:hover {
color: #1e40af;
}
.nav-link.active {
color: #1e40af;
font-weight: 600;
}
.mobile-menu-btn {
display: none;
background: none;
border: none;
cursor: pointer;
color: #4b5563;
}
@media (max-width: 768px) {
.nav-links {
display: none;
}
.mobile-menu-btn {
display: block;
}
}
</style>
<nav>
<a href="/" class="logo">
<i data-feather="cpu" class="logo-icon"></i>
MicroChip Explorer
</a>
<div class="nav-links">
<a href="/" class="nav-link active">Home</a>
<a href="#" class="nav-link">Products</a>
<a href="#" class="nav-link">Documentation</a>
<a href="#" class="nav-link">Support</a>
<a href="#" class="nav-link">About</a>
</div>
<button class="mobile-menu-btn">
<i data-feather="menu"></i>
</button>
</nav>
`;
}
}
customElements.define('custom-navbar', CustomNavbar);