visman1990's picture
stp sort moi une page comme ça https://bibliographienationale.bnf.fr/
482f77b verified
Raw History Blame Contribute Delete
4.62 kB
class CustomHeader extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
nav {
font-family: 'Roboto', sans-serif;
}
.nav-link {
transition: color 0.3s ease;
}
.nav-link:hover {
color: var(--primary-500);
}
.dropdown:hover .dropdown-menu {
display: block;
}
</style>
<header class="bg-white shadow-md">
<div class="container mx-auto px-4">
<div class="flex justify-between items-center py-4">
<!-- Logo -->
<a href="/" class="flex items-center">
<img src="http://static.photos/education/200x200/1" alt="BnF Logo" class="h-12 mr-3">
<span class="text-xl font-bold text-primary-700">Bibliographie Nationale</span>
</a>
<!-- Mobile Menu Button -->
<button class="md:hidden focus:outline-none" id="mobile-menu-button">
<i data-feather="menu"></i>
</button>
<!-- Desktop Navigation -->
<nav class="hidden md:flex items-center space-x-8">
<a href="/" class="nav-link text-secondary-700 hover:text-primary-500">Accueil</a>
<a href="/collections" class="nav-link text-secondary-700 hover:text-primary-500">Collections</a>
<a href="/recherche" class="nav-link text-secondary-700 hover:text-primary-500">Recherche avancée</a>
<a href="/a-propos" class="nav-link text-secondary-700 hover:text-primary-500">À propos</a>
<!-- User Actions -->
<div class="flex items-center space-x-4 ml-6">
<a href="/connexion" class="text-secondary-700 hover:text-primary-500">
<i data-feather="user"></i>
</a>
<a href="/panier" class="text-secondary-700 hover:text-primary-500">
<i data-feather="shopping-cart"></i>
</a>
</div>
</nav>
</div>
<!-- Mobile Menu -->
<div class="md:hidden hidden py-4" id="mobile-menu">
<div class="flex flex-col space-y-3">
<a href="/" class="nav-link text-secondary-700 hover:text-primary-500">Accueil</a>
<a href="/collections" class="nav-link text-secondary-700 hover:text-primary-500">Collections</a>
<a href="/recherche" class="nav-link text-secondary-700 hover:text-primary-500">Recherche avancée</a>
<a href="/a-propos" class="nav-link text-secondary-700 hover:text-primary-500">À propos</a>
<div class="pt-3 border-t border-gray-200 mt-3">
<a href="/connexion" class="inline-flex items-center text-secondary-700 hover:text-primary-500">
<i data-feather="user" class="mr-2"></i> Connexion
</a>
</div>
</div>
</div>
</div>
</header>
`;
// Mobile menu toggle
const mobileMenuButton = this.shadowRoot.getElementById('mobile-menu-button');
const mobileMenu = this.shadowRoot.getElementById('mobile-menu');
if (mobileMenuButton && mobileMenu) {
mobileMenuButton.addEventListener('click', () => {
const isHidden = mobileMenu.classList.contains('hidden');
if (isHidden) {
mobileMenu.classList.remove('hidden');
mobileMenu.classList.add('block');
} else {
mobileMenu.classList.add('hidden');
mobileMenu.classList.remove('block');
}
});
}
}
}
customElements.define('custom-header', CustomHeader);