tedbeardk's picture
create a slick landing page. a dark colorful background. A title of "test" and below 3 horizontal images, divided like cartoon images are divided in a comic book
42538c9 verified
class CustomHeader extends HTMLElement {
constructor() {
super();
}
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
width: 100%;
}
.header-container {
background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 27, 75, 0.8) 100%);
backdrop-filter: blur(10px);
border-bottom: 1px solid rgba(14, 165, 233, 0.2);
position: sticky;
top: 0;
z-index: 100;
}
.header-content {
max-width: 1280px;
margin: 0 auto;
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
display: flex;
align-items: center;
gap: 0.75rem;
text-decoration: none;
}
.logo-icon {
width: 2.5rem;
height: 2.5rem;
background: linear-gradient(45deg, #0ea5e9, #ec4899);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
transform: rotate(-5deg);
transition: transform 0.3s ease;
}
.logo:hover .logo-icon {
transform: rotate(0deg) scale(1.1);
}
.logo-text {
background: linear-gradient(to right, #7dd3fc, #f472b6);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
font-weight: 800;
font-size: 1.5rem;
letter-spacing: -0.5px;
}
.nav-links {
display: flex;
gap: 2rem;
align-items: center;
}
.nav-link {
color: #cbd5e1;
text-decoration: none;
font-weight: 500;
padding: 0.5rem 1rem;
border-radius: 8px;
transition: all 0.3s ease;
position: relative;
}
.nav-link:hover {
color: white;
background: rgba(14, 165, 233, 0.1);
}
.nav-link.active {
color: white;
background: linear-gradient(90deg, rgba(14, 165, 233, 0.2), rgba(236, 72, 153, 0.2));
}
.nav-link.active::after {
content: '';
position: absolute;
bottom: -2px;
left: 1rem;
right: 1rem;
height: 2px;
background: linear-gradient(90deg, #0ea5e9, #ec4899);
border-radius: 1px;
}
.mobile-menu-btn {
display: none;
background: none;
border: none;
color: #cbd5e1;
cursor: pointer;
padding: 0.5rem;
border-radius: 8px;
transition: background 0.3s ease;
}
.mobile-menu-btn:hover {
background: rgba(255, 255, 255, 0.1);
}
@media (max-width: 768px) {
.header-content {
padding: 1rem;
}
.nav-links {
display: none;
}
.mobile-menu-btn {
display: block;
}
.mobile-menu {
display: none;
position: absolute;
top: 100%;
left: 0;
right: 0;
background: rgba(15, 23, 42, 0.95);
backdrop-filter: blur(10px);
border-bottom: 1px solid rgba(14, 165, 233, 0.2);
padding: 1rem;
flex-direction: column;
gap: 0.5rem;
}
.mobile-menu.active {
display: flex;
}
.mobile-nav-link {
color: #cbd5e1;
text-decoration: none;
padding: 0.75rem 1rem;
border-radius: 8px;
transition: all 0.3s ease;
}
.mobile-nav-link:hover {
color: white;
background: rgba(14, 165, 233, 0.1);
}
}
</style>
<header class="header-container">
<div class="header-content">
<a href="/" class="logo">
<div class="logo-icon">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2L2 7L12 12L22 7L12 2Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M2 17L12 22L22 17" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M2 12L12 17L22 12" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<span class="logo-text">TESTCOMIX</span>
</a>
<nav class="nav-links">
<a href="/" class="nav-link active">
<i data-feather="home" width="16" height="16" style="vertical-align: text-bottom; margin-right: 6px;"></i>
Home
</a>
<a href="/gallery" class="nav-link">
<i data-feather="image" width="16" height="16" style="vertical-align: text-bottom; margin-right: 6px;"></i>
Gallery
</a>
<a href="/create" class="nav-link">
<i data-feather="edit-3" width="16" height="16" style="vertical-align: text-bottom; margin-right: 6px;"></i>
Create
</a>
<a href="/about" class="nav-link">
<i data-feather="info" width="16" height="16" style="vertical-align: text-bottom; margin-right: 6px;"></i>
About
</a>
<a href="/contact" class="nav-link">
<i data-feather="mail" width="16" height="16" style="vertical-align: text-bottom; margin-right: 6px;"></i>
Contact
</a>
</nav>
<button class="mobile-menu-btn" id="mobileMenuBtn">
<i data-feather="menu" width="24" height="24"></i>
</button>
</div>
<div class="mobile-menu" id="mobileMenu">
<a href="/" class="mobile-nav-link active">
<i data-feather="home" width="16" height="16" style="vertical-align: text-bottom; margin-right: 8px;"></i>
Home
</a>
<a href="/gallery" class="mobile-nav-link">
<i data-feather="image" width="16" height="16" style="vertical-align: text-bottom; margin-right: 8px;"></i>
Gallery
</a>
<a href="/create" class="mobile-nav-link">
<i data-feather="edit-3" width="16" height="16" style="vertical-align: text-bottom; margin-right: 8px;"></i>
Create
</a>
<a href="/about" class="mobile-nav-link">
<i data-feather="info" width="16" height="16" style="vertical-align: text-bottom; margin-right: 8px;"></i>
About
</a>
<a href="/contact" class="mobile-nav-link">
<i data-feather="mail" width="16" height="16" style="vertical-align: text-bottom; margin-right: 8px;"></i>
Contact
</a>
</div>
</header>
`;
// Add event listener for mobile menu
this.shadowRoot.getElementById('mobileMenuBtn').addEventListener('click', () => {
const menu = this.shadowRoot.getElementById('mobileMenu');
menu.classList.toggle('active');
});
// Replace feather icons after component is attached
if (window.feather) {
window.feather.replace();
} else {
window.addEventListener('feather-icons-loaded', () => {
window.feather.replace();
});
}
}
}
customElements.define('custom-header', CustomHeader);