raouia12's picture
affiche ce code //- views/parameter.jade
21918f8 verified
Raw History Blame Contribute Delete
2.02 kB
class CustomHeader extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
header {
background-color: var(--atos-blue);
padding: 0.5rem 1.5rem;
border-bottom: 1px solid #0073e6;
margin-bottom: 1rem;
}
.header-content {
display: flex;
align-items: center;
justify-content: space-between;
max-width: 1200px;
margin: 0 auto;
}
.logo {
height: 1.5rem;
width: auto;
}
.button {
background-color: var(--atos-blue);
color: white;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
font-weight: 500;
transition: background-color 0.2s;
display: inline-flex;
align-items: center;
}
.button:hover {
background-color: var(--dark-blue);
}
.button i {
margin-right: 0.5rem;
width: 1rem;
height: 1rem;
}
.button-group {
display: flex;
gap: 0.5rem;
}
</style>
<header>
<div class="header-content">
<img class="logo" src="http://static.photos/technology/200x200/1" alt="Logo" loading="lazy">
<div class="button-group">
<a href="/" class="button">
<i data-feather="home"></i>
Homepage
</a>
<button id="closeBtn" class="button">
<i data-feather="x"></i>
Close
</button>
</div>
</div>
</header>
`;
this.shadowRoot.getElementById('closeBtn').addEventListener('click', () => {
if (!window.close()) {
history.back();
}
});
// Load feather icons
if (window.feather) {
window.feather.replace({ class: 'feather-inline' });
}
}
}
customElements.define('custom-header', CustomHeader);