boatable-mvp / components /header.js
productJ's picture
# 🚢 **BOATABLE MVP FRONTEND - COMPREHENSIVE OVERVIEW**
feb6f9e verified
Raw History Blame Contribute Delete
4.77 kB
class CustomHeader extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
}
.header-container {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1000;
background-color: white;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}
.header-content {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 1.5rem;
max-width: 100%;
}
.logo {
display: flex;
align-items: center;
font-weight: 700;
font-size: 1.5rem;
color: #2563eb;
text-decoration: none;
}
.logo-icon {
margin-right: 0.5rem;
}
.nav-links {
display: flex;
list-style: none;
}
.nav-links li {
margin-left: 1.5rem;
}
.nav-links a {
text-decoration: none;
color: #334155;
font-weight: 500;
transition: color 0.3s ease;
}
.nav-links a:hover {
color: #2563eb;
}
.auth-buttons {
display: flex;
align-items: center;
}
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
font-weight: 500;
transition: all 0.3s ease;
cursor: pointer;
border: none;
outline: none;
}
.btn-login {
background-color: transparent;
color: #334155;
margin-right: 0.75rem;
}
.btn-login:hover {
color: #2563eb;
}
.btn-signup {
background-color: #2563eb;
color: white;
}
.btn-signup:hover {
background-color: #1d4ed8;
}
.menu-toggle {
display: none;
background: none;
border: none;
cursor: pointer;
color: #334155;
}
@media (max-width: 767px) {
.nav-links,
.auth-buttons {
display: none;
}
.menu-toggle {
display: block;
}
}
</style>
<header class="header-container">
<div class="header-content">
<a href="/" class="logo">
<svg class="logo-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.5 0 2.5 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/>
<path d="M19.38 20A11.6 11.6 0 0 0 21 14l-1.5-1.5a4.93 4.93 0 0 0-3-1 4.93 4.93 0 0 0-3 1L12 14l-1.5-1.5a4.93 4.93 0 0 0-3-1 4.93 4.93 0 0 0-3 1L3 14a11.6 11.6 0 0 0 1.62 6"/>
<path d="M2 15v-1a3 3 0 0 1 3-3h1"/>
<path d="M22 15v-1a3 3 0 0 0-3-3h-1"/>
<path d="M12 12v-2a3 3 0 0 0-3-3H8"/>
<path d="M12 12v-2a3 3 0 0 1 3-3h1"/>
</svg>
Boatable
</a>
<nav>
<ul class="nav-links">
<li><a href="/">Home</a></li>
<li><a href="#">Features</a></li>
<li><a href="#">Pricing</a></li>
<li><a href="#">About</a></li>
</ul>
</nav>
<div class="auth-buttons">
<a href="/login.html" class="btn btn-login">Log in</a>
<a href="/signup.html" class="btn btn-signup">Sign up</a>
</div>
<button class="menu-toggle" id="menu-toggle">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="3" y1="12" x2="21" y2="12"></line>
<line x1="3" y1="6" x2="21" y2="6"></line>
<line x1="3" y1="18" x2="21" y2="18"></line>
</svg>
</button>
</div>
</header>
`;
// Add event listener for menu toggle
this.shadowRoot.addEventListener('click', (e) => {
if (e.target.closest('#menu-toggle')) {
window.toggleMobileMenu();
}
});
}
}
customElements.define('custom-header', CustomHeader);