neuromorph-gallery / components /crypto-navbar.js
flitrx's picture
Design a neomorphic cryptocurrency tracker website using Web3 with blockchain integration. Make this a fully functional ready to launch website. Provide detailed specifications for user experience, technical architecture, and monetization strategy.
83820df verified
class CryptoNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
position: sticky;
top: 0;
z-index: 50;
}
nav {
background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(31, 41, 55, 0.95));
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
backdrop-filter: blur(10px);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.logo {
color: white;
font-weight: 800;
font-size: 1.5rem;
background: linear-gradient(135deg, #10b981, #059669);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.nav-links {
display: flex;
gap: 2rem;
list-style: none;
margin: 0;
padding: 0;
align-items: center;
}
.nav-link {
color: white;
text-decoration: none;
font-weight: 500;
transition: all 0.3s ease;
display: flex;
align-items: center;
gap: 0.5rem;
}
.nav-link:hover {
color: #10b981;
transform: translateY(-1px);
}
.search-container {
position: relative;
display: flex;
align-items: center;
}
.search-input {
background: linear-gradient(145deg, #1f2937, #111827);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 25px;
padding: 0.5rem 1rem 0.5rem 2.5rem;
color: white;
transition: all 0.3s ease;
box-shadow: inset 4px 4px 8px #0a0e14, inset -4px -4px 8px #243142;
}
.search-input:focus {
outline: none;
border-color: #10b981;
}
.search-icon {
position: absolute;
left: 1rem;
color: #9ca3af;
}
.mobile-menu-btn {
display: none;
background: none;
border: none;
color: white;
cursor: pointer;
}
@media (max-width: 768px) {
nav {
padding: 1rem;
}
.nav-links {
display: none;
position: absolute;
top: 100%;
left: 0;
right: 0;
background: #111827;
flex-direction: column;
padding: 1rem;
gap: 1rem;
}
.nav-links.active {
display: flex;
}
.mobile-menu-btn {
display: block;
}
}
</style>
<nav>
<div class="logo">CryptoSphere</div>
<ul class="nav-links">
<li>
<a href="/crypto-tracker.html" class="nav-link">
<i data-feather="home"></i>
Home
</a>
</li>
<li>
<a href="#market-overview" class="nav-link">
<i data-feather="trending-up"></i>
Markets
</a>
</li>
<li>
<a href="/crypto-portfolio.html" class="nav-link">
<i data-feather="pie-chart"></i>
Portfolio
</a>
</li>
<li>
<a href="/crypto-analytics.html" class="nav-link">
<i data-feather="bar-chart"></i>
Analytics
</a>
</li>
<li class="search-container">
<i data-feather="search" class="search-icon"></i>
<input type="search" placeholder="Search cryptocurrencies..." class="search-input">
</li>
</ul>
<button class="mobile-menu-btn">
<i data-feather="menu"></i>
</button>
</nav>
`;
this.setupMobileMenu();
this.setupSearch();
}
setupMobileMenu() {
const menuBtn = this.shadowRoot.querySelector('.mobile-menu-btn');
const navLinks = this.shadowRoot.querySelector('.nav-links');
menuBtn.addEventListener('click', () => {
navLinks.classList.toggle('active');
const icon = menuBtn.querySelector('i');
if (navLinks.classList.contains('active')) {
icon.setAttribute('data-feather', 'x');
} else {
icon.setAttribute('data-feather', 'menu');
}
feather.replace();
});
}
setupSearch() {
const searchInput = this.shadowRoot.querySelector('.search-input');
searchInput.addEventListener('input', (e) => {
const query = e.target.value;
this.searchCryptos(query);
});
}
searchCryptos(query) {
const event = new CustomEvent('crypto-search', {
detail: { query }
});
this.shadowRoot.dispatchEvent(event);
}
}
customElements.define('crypto-navbar', CryptoNavbar);