progitanas1's picture
2000 ligne de code
32738c4 verified
class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
nav {
background: white;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
position: fixed;
width: 100%;
z-index: 10;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 1rem;
display: flex;
justify-content: space-between;
align-items: center;
height: 4rem;
}
.logo {
display: flex;
align-items: center;
font-weight: bold;
font-size: 1.25rem;
color: #4F46E5;
}
.logo-icon {
margin-right: 0.5rem;
}
.nav-links {
display: flex;
gap: 2rem;
}
.nav-link {
color: #4B5563;
text-decoration: none;
font-weight: 500;
position: relative;
padding: 0.5rem 0;
}
.nav-link:hover {
color: #1F2937;
}
.nav-link::after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 2px;
bottom: 0;
left: 0;
background-color: #EC4899;
transform-origin: bottom right;
transition: transform 0.25s ease-out;
}
.nav-link:hover::after {
transform: scaleX(1);
transform-origin: bottom left;
}
.demo-btn {
background: #4F46E5;
color: white;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
font-weight: 500;
transition: all 0.2s;
}
.demo-btn:hover {
background: #4338CA;
transform: translateY(-1px);
}
@media (max-width: 768px) {
.nav-links {
display: none;
}
}
</style>
<nav>
<div class="container">
<a href="/" class="logo">
<svg class="logo-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2L3 12L12 22L21 12L12 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M7 12H17" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
TextileTech
</a>
<div class="nav-links">
<a href="#solution" class="nav-link">Solution</a>
<a href="#modules" class="nav-link">Modules</a>
<a href="#avantages" class="nav-link">Avantages</a>
<a href="#contact" class="nav-link">Contact</a>
</div>
<button class="demo-btn">Demander une démo</button>
</div>
</nav>
`;
}
}
customElements.define('custom-navbar', CustomNavbar);