diff --git a/public/header-snippet.html b/public/header-snippet.html index 82283e7..d8a49ca 100644 --- a/public/header-snippet.html +++ b/public/header-snippet.html @@ -2,12 +2,26 @@ The land of the penguin -
- - - - - -
\ No newline at end of file + + + + + \ No newline at end of file diff --git a/public/scripts/common.js b/public/scripts/common.js index 4cf68e6..7c727c4 100644 --- a/public/scripts/common.js +++ b/public/scripts/common.js @@ -1,11 +1,25 @@ const headerElement = document.querySelector('header'); const footerElement = document.querySelector('footer'); +let isLoggedIn = false; + async function loadHeaderFooter() { try { const headerResponse = await fetch('https://commonhtml.thepenguinontheweb.tech/header-snippet.html'); if (!headerResponse.ok) throw new Error('Failed to load header'); const headerHTML = await headerResponse.text(); + + const backButtonTemplate = document.getElementById('back-button-template').innerHTML; + const loginTemplate = document.getElementById('login-template').innerHTML; + const myAccountTemplate = document.getElementById('my-account-template').innerHTML; + + if (isLoggedIn) { + headerElement.innerHTML += myAccountTemplate.cloneNode(true); + } + else { + headerElement.innerHTML += loginTemplate.cloneNode(true); + } + headerElement.innerHTML = headerHTML; const footerResponse = await fetch('https://commonhtml.thepenguinontheweb.tech/footer-snippet.html'); diff --git a/public/styles/common.css b/public/styles/common.css index 6b75486..b5b4d05 100644 --- a/public/styles/common.css +++ b/public/styles/common.css @@ -279,22 +279,22 @@ main { margin-bottom: 10px; /* Espace entre les champs */ } +} - button { - padding: 10px 20px; - border-radius: 5px; - border: none; - background-color: #9ccfcd; - color: white; - font-size: 16px; - cursor: pointer; +button { + padding: 10px 20px; + border-radius: 5px; + border: none; + background-color: #9ccfcd; + color: white; + font-size: 16px; + cursor: pointer; - transition: background-color 0.3s ease-in-out; + transition: background-color 0.3s ease-in-out; - &:hover { - background-color: #7fb1ae; - /* Couleur au survol */ - } + &:hover { + background-color: #7fb1ae; + /* Couleur au survol */ } }