File size: 7,072 Bytes
14a31b5 df8502b 14a31b5 df8502b 14a31b5 df8502b 14a31b5 df8502b 14a31b5 df8502b 14a31b5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
class DocNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1000;
}
nav {
background: rgba(17, 24, 39, 0.8);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
transition: all 0.3s ease;
}
.nav-wrapper {
max-width: 7xl;
margin: 0 auto;
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
display: flex;
align-items: center;
gap: 0.75rem;
font-size: 1.5rem;
font-weight: bold;
background: linear-gradient(to right, #06b6d4, #8b5cf6);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
text-decoration: none;
transition: all 0.3s ease;
}
.logo:hover {
transform: scale(1.05);
}
.nav-links {
display: flex;
gap: 2rem;
align-items: center;
}
.nav-link {
color: #d1d5db;
text-decoration: none;
transition: all 0.3s ease;
position: relative;
}
.nav-link:hover {
color: #06b6d4;
}
.nav-link::after {
content: '';
position: absolute;
bottom: -4px;
left: 0;
width: 0;
height: 2px;
background: linear-gradient(to right, #06b6d4, #8b5cf6);
transition: width 0.3s ease;
}
.nav-link:hover::after {
width: 100%;
}
.cta-button {
background: linear-gradient(to right, #06b6d4, #8b5cf6);
color: white;
padding: 0.75rem 1.5rem;
border-radius: 9999px;
text-decoration: none;
font-weight: 600;
transition: all 0.3s ease;
}
.cta-button:hover {
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(6, 182, 212, 0.3);
}
.mobile-menu-toggle {
display: none;
background: none;
border: none;
color: white;
cursor: pointer;
padding: 0.5rem;
}
.mobile-menu {
display: none;
position: absolute;
top: 100%;
left: 0;
right: 0;
background: rgba(17, 24, 39, 0.95);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
padding: 2rem;
gap: 1.5rem;
flex-direction: column;
}
.mobile-menu.active {
display: flex;
}
@media (max-width: 768px) {
.nav-links {
display: none;
}
.mobile-menu-toggle {
display: block;
}
}
</style>
<nav>
<div class="nav-wrapper">
<a href="/" class="logo">
<i data-feather="cpu"></i>
Arduino DocVortex
</a>
<div class="nav-links">
<a href="#boards" class="nav-link">Boards</a>
<a href="code.html" class="nav-link">Code Reference</a>
<a href="#tutorials" class="nav-link">Tutorials</a>
<a href="#libraries" class="nav-link">Libraries</a>
<a href="code.html" class="cta-button">Get Started</a>
</div>
<button class="mobile-menu-toggle" data-mobile-menu-toggle>
<i data-feather="menu" class="w-6 h-6"></i>
</button>
</div>
<div class="mobile-menu" data-mobile-menu>
<a href="#boards" class="nav-link">Boards</a>
<a href="code.html" class="nav-link">Code Reference</a>
<a href="#tutorials" class="nav-link">Tutorials</a>
<a href="#libraries" class="nav-link">Libraries</a>
<a href="code.html" class="cta-button">Get Started</a>
</div>
</nav>
`;
// Add mobile menu toggle functionality
setTimeout(() => {
const toggle = this.shadowRoot.querySelector('[data-mobile-menu-toggle]');
const menu = this.shadowRoot.querySelector('[data-mobile-menu]');
if (toggle && menu) {
toggle.addEventListener('click', () => {
menu.classList.toggle('active');
});
}
// Replace feather icons
if (typeof feather !== 'undefined') {
feather.replace({
'stroke-width': 2,
'height': 24,
'width': 24
});
}
}, 100);
// Add scroll effect
window.addEventListener('scroll', () => {
const nav = this.shadowRoot.querySelector('nav');
if (window.scrollY > 50) {
nav.style.background = 'rgba(17, 24, 39, 0.95)';
nav.style.boxShadow = '0 4px 20px rgba(0, 0, 0, 0.3)';
} else {
nav.style.background = 'rgba(17, 24, 39, 0.8)';
nav.style.boxShadow = 'none';
}
});
}
}
customElements.define('doc-navbar', DocNavbar); |