Spaces:
Running
Running
I want to make a website to sell FPV Drones both for civilian, comercial, agricultural and military use. I want sections where customers can choose their own parts for maximum customization. Must be made in Spanish.
Browse files- README.md +8 -5
- components/cart.js +314 -0
- components/customizer.js +367 -0
- components/footer.js +178 -0
- components/navbar.js +214 -0
- index.html +204 -19
- script.js +201 -0
- style.css +51 -19
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: DronesLibres.ai ✈️
|
| 3 |
+
colorFrom: yellow
|
| 4 |
+
colorTo: green
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://huggingface.co/deepsite).
|
components/cart.js
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class DroneCart extends HTMLElement {
|
| 2 |
+
constructor() {
|
| 3 |
+
super();
|
| 4 |
+
this.cartItems = JSON.parse(localStorage.getItem('droneCart')) || [];
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
connectedCallback() {
|
| 8 |
+
this.attachShadow({ mode: 'open' });
|
| 9 |
+
this.render();
|
| 10 |
+
this.addEventListeners();
|
| 11 |
+
this.style.position = 'fixed';
|
| 12 |
+
this.style.top = '0';
|
| 13 |
+
this.style.right = '-400px';
|
| 14 |
+
this.style.width = '400px';
|
| 15 |
+
this.style.height = '100vh';
|
| 16 |
+
this.style.zIndex = '1001';
|
| 17 |
+
this.style.transition = 'right 0.3s ease-in-out';
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
render() {
|
| 21 |
+
this.shadowRoot.innerHTML = `
|
| 22 |
+
<style>
|
| 23 |
+
:host {
|
| 24 |
+
display: block;
|
| 25 |
+
font-family: 'Inter', sans-serif;
|
| 26 |
+
}
|
| 27 |
+
.cart-sidebar {
|
| 28 |
+
height: 100%;
|
| 29 |
+
background: white;
|
| 30 |
+
box-shadow: -5px 0 30px rgba(0, 0, 0, 0.1);
|
| 31 |
+
display: flex;
|
| 32 |
+
flex-direction: column;
|
| 33 |
+
}
|
| 34 |
+
.cart-header {
|
| 35 |
+
padding: 1.5rem;
|
| 36 |
+
border-bottom: 1px solid #e5e7eb;
|
| 37 |
+
display: flex;
|
| 38 |
+
justify-content: space-between;
|
| 39 |
+
align-items: center;
|
| 40 |
+
}
|
| 41 |
+
.cart-items {
|
| 42 |
+
flex: 1;
|
| 43 |
+
overflow-y: auto;
|
| 44 |
+
padding: 1.5rem;
|
| 45 |
+
}
|
| 46 |
+
.cart-item {
|
| 47 |
+
display: flex;
|
| 48 |
+
padding: 1rem;
|
| 49 |
+
border-bottom: 1px solid #f3f4f6;
|
| 50 |
+
align-items: center;
|
| 51 |
+
}
|
| 52 |
+
.cart-item-image {
|
| 53 |
+
width: 80px;
|
| 54 |
+
height: 80px;
|
| 55 |
+
border-radius: 0.5rem;
|
| 56 |
+
overflow: hidden;
|
| 57 |
+
flex-shrink: 0;
|
| 58 |
+
}
|
| 59 |
+
.cart-item-details {
|
| 60 |
+
flex: 1;
|
| 61 |
+
margin-left: 1rem;
|
| 62 |
+
}
|
| 63 |
+
.cart-item-quantity {
|
| 64 |
+
display: flex;
|
| 65 |
+
align-items: center;
|
| 66 |
+
gap: 0.5rem;
|
| 67 |
+
margin-top: 0.5rem;
|
| 68 |
+
}
|
| 69 |
+
.quantity-btn {
|
| 70 |
+
width: 28px;
|
| 71 |
+
height: 28px;
|
| 72 |
+
border-radius: 50%;
|
| 73 |
+
background: #f3f4f6;
|
| 74 |
+
display: flex;
|
| 75 |
+
align-items: center;
|
| 76 |
+
justify-content: center;
|
| 77 |
+
cursor: pointer;
|
| 78 |
+
transition: background 0.2s;
|
| 79 |
+
}
|
| 80 |
+
.quantity-btn:hover {
|
| 81 |
+
background: #e5e7eb;
|
| 82 |
+
}
|
| 83 |
+
.remove-btn {
|
| 84 |
+
color: #ef4444;
|
| 85 |
+
cursor: pointer;
|
| 86 |
+
transition: color 0.2s;
|
| 87 |
+
}
|
| 88 |
+
.remove-btn:hover {
|
| 89 |
+
color: #dc2626;
|
| 90 |
+
}
|
| 91 |
+
.cart-footer {
|
| 92 |
+
padding: 1.5rem;
|
| 93 |
+
border-top: 1px solid #e5e7eb;
|
| 94 |
+
background: #f9fafb;
|
| 95 |
+
}
|
| 96 |
+
.summary-row {
|
| 97 |
+
display: flex;
|
| 98 |
+
justify-content: space-between;
|
| 99 |
+
margin-bottom: 0.5rem;
|
| 100 |
+
}
|
| 101 |
+
.checkout-btn {
|
| 102 |
+
width: 100%;
|
| 103 |
+
background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
|
| 104 |
+
color: white;
|
| 105 |
+
padding: 1rem;
|
| 106 |
+
border-radius: 0.75rem;
|
| 107 |
+
font-weight: 600;
|
| 108 |
+
border: none;
|
| 109 |
+
cursor: pointer;
|
| 110 |
+
transition: all 0.3s;
|
| 111 |
+
margin-top: 1rem;
|
| 112 |
+
}
|
| 113 |
+
.checkout-btn:hover {
|
| 114 |
+
transform: translateY(-2px);
|
| 115 |
+
box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
|
| 116 |
+
}
|
| 117 |
+
.empty-cart {
|
| 118 |
+
text-align: center;
|
| 119 |
+
padding: 3rem 1rem;
|
| 120 |
+
color: #6b7280;
|
| 121 |
+
}
|
| 122 |
+
.empty-cart-icon {
|
| 123 |
+
margin: 0 auto 1rem;
|
| 124 |
+
width: 64px;
|
| 125 |
+
height: 64px;
|
| 126 |
+
background: #f3f4f6;
|
| 127 |
+
border-radius: 50%;
|
| 128 |
+
display: flex;
|
| 129 |
+
align-items: center;
|
| 130 |
+
justify-content: center;
|
| 131 |
+
}
|
| 132 |
+
@media (max-width: 640px) {
|
| 133 |
+
:host {
|
| 134 |
+
width: 100%;
|
| 135 |
+
right: -100%;
|
| 136 |
+
}
|
| 137 |
+
}
|
| 138 |
+
</style>
|
| 139 |
+
<div class="cart-sidebar">
|
| 140 |
+
<!-- Header -->
|
| 141 |
+
<div class="cart-header">
|
| 142 |
+
<h2 class="text-xl font-bold">
|
| 143 |
+
<i data-feather="shopping-cart" class="inline mr-2"></i>
|
| 144 |
+
Tu Carro
|
| 145 |
+
</h2>
|
| 146 |
+
<button id="close-cart" class="text-gray-500 hover:text-gray-700">
|
| 147 |
+
<i data-feather="x" class="w-6 h-6"></i>
|
| 148 |
+
</button>
|
| 149 |
+
</div>
|
| 150 |
+
|
| 151 |
+
<!-- Items -->
|
| 152 |
+
<div class="cart-items" id="cart-items-container">
|
| 153 |
+
${this.cartItems.length > 0 ? this.renderCartItems() : this.renderEmptyCart()}
|
| 154 |
+
</div>
|
| 155 |
+
|
| 156 |
+
<!-- Footer -->
|
| 157 |
+
${this.cartItems.length > 0 ? this.renderCartFooter() : ''}
|
| 158 |
+
</div>
|
| 159 |
+
`;
|
| 160 |
+
|
| 161 |
+
if (typeof feather !== 'undefined') {
|
| 162 |
+
feather.replace();
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
renderCartItems() {
|
| 167 |
+
return this.cartItems.map(item => `
|
| 168 |
+
<div class="cart-item" data-id="${item.id}">
|
| 169 |
+
<div class="cart-item-image">
|
| 170 |
+
<img src="http://static.photos/technology/200x200/${100 + parseInt(item.id)}"
|
| 171 |
+
alt="${item.name}"
|
| 172 |
+
class="w-full h-full object-cover">
|
| 173 |
+
</div>
|
| 174 |
+
<div class="cart-item-details">
|
| 175 |
+
<h4 class="font-semibold">${item.name}</h4>
|
| 176 |
+
<p class="text-primary font-bold">$${item.price.toLocaleString('es-ES')}</p>
|
| 177 |
+
<div class="cart-item-quantity">
|
| 178 |
+
<button class="decrease-btn quantity-btn" data-id="${item.id}">
|
| 179 |
+
<i data-feather="minus" class="w-3 h-3"></i>
|
| 180 |
+
</button>
|
| 181 |
+
<span class="font-medium">${item.quantity}</span>
|
| 182 |
+
<button class="increase-btn quantity-btn" data-id="${item.id}">
|
| 183 |
+
<i data-feather="plus" class="w-3 h-3"></i>
|
| 184 |
+
</button>
|
| 185 |
+
<button class="remove-btn ml-4" data-id="${item.id}">
|
| 186 |
+
<i data-feather="trash-2" class="w-4 h-4"></i>
|
| 187 |
+
</button>
|
| 188 |
+
</div>
|
| 189 |
+
</div>
|
| 190 |
+
</div>
|
| 191 |
+
`).join('');
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
renderEmptyCart() {
|
| 195 |
+
return `
|
| 196 |
+
<div class="empty-cart">
|
| 197 |
+
<div class="empty-cart-icon">
|
| 198 |
+
<i data-feather="package" class="w-8 h-8 text-gray-400"></i>
|
| 199 |
+
</div>
|
| 200 |
+
<h3 class="text-lg font-semibold mb-2">Carro vacío</h3>
|
| 201 |
+
<p class="text-gray-500 mb-4">Agrega algunos drones para empezar</p>
|
| 202 |
+
<a href="#personalizar" class="inline-block bg-primary hover:bg-blue-700 text-white px-6 py-3 rounded-lg font-semibold transition duration-300">
|
| 203 |
+
Personalizar Drone
|
| 204 |
+
</a>
|
| 205 |
+
</div>
|
| 206 |
+
`;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
renderCartFooter() {
|
| 210 |
+
const subtotal = this.cartItems.reduce((sum, item) => sum + (item.price * item.quantity), 0);
|
| 211 |
+
const shipping = subtotal > 1000 ? 0 : 99;
|
| 212 |
+
const total = subtotal + shipping;
|
| 213 |
+
|
| 214 |
+
return `
|
| 215 |
+
<div class="cart-footer">
|
| 216 |
+
<div class="summary-row">
|
| 217 |
+
<span>Subtotal</span>
|
| 218 |
+
<span class="font-semibold">$${subtotal.toLocaleString('es-ES')}</span>
|
| 219 |
+
</div>
|
| 220 |
+
<div class="summary-row">
|
| 221 |
+
<span>Envío</span>
|
| 222 |
+
<span class="font-semibold">${shipping === 0 ? 'Gratis' : `$${shipping}`}</span>
|
| 223 |
+
</div>
|
| 224 |
+
<div class="summary-row text-lg font-bold border-t pt-3 mt-3">
|
| 225 |
+
<span>Total</span>
|
| 226 |
+
<span>$${total.toLocaleString('es-ES')}</span>
|
| 227 |
+
</div>
|
| 228 |
+
<button id="checkout-btn" class="checkout-btn">
|
| 229 |
+
Proceder al Pago
|
| 230 |
+
</button>
|
| 231 |
+
<p class="text-xs text-gray-500 text-center mt-4">
|
| 232 |
+
<i data-feather="lock" class="inline w-3 h-3 mr-1"></i>
|
| 233 |
+
Pago 100% seguro
|
| 234 |
+
</p>
|
| 235 |
+
</div>
|
| 236 |
+
`;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
addEventListeners() {
|
| 240 |
+
// Close cart
|
| 241 |
+
this.shadowRoot.getElementById('close-cart')?.addEventListener('click', () => {
|
| 242 |
+
this.style.right = '-400px';
|
| 243 |
+
document.getElementById('cart-overlay')?.classList.add('hidden', 'opacity-0');
|
| 244 |
+
});
|
| 245 |
+
|
| 246 |
+
// Cart item interactions
|
| 247 |
+
this.shadowRoot.addEventListener('click', (e) => {
|
| 248 |
+
const target = e.target.closest('button');
|
| 249 |
+
if (!target) return;
|
| 250 |
+
|
| 251 |
+
const id = target.dataset.id;
|
| 252 |
+
const item = this.cartItems.find(item => item.id === id);
|
| 253 |
+
|
| 254 |
+
if (target.classList.contains('decrease-btn')) {
|
| 255 |
+
if (item && item.quantity > 1) {
|
| 256 |
+
item.quantity--;
|
| 257 |
+
} else {
|
| 258 |
+
this.cartItems = this.cartItems.filter(item => item.id !== id);
|
| 259 |
+
}
|
| 260 |
+
} else if (target.classList.contains('increase-btn')) {
|
| 261 |
+
if (item) item.quantity++;
|
| 262 |
+
} else if (target.classList.contains('remove-btn')) {
|
| 263 |
+
this.cartItems = this.cartItems.filter(item => item.id !== id);
|
| 264 |
+
} else if (target.id === 'checkout-btn') {
|
| 265 |
+
alert('Redirigiendo al proceso de pago...');
|
| 266 |
+
return;
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
this.updateCart();
|
| 270 |
+
this.render();
|
| 271 |
+
if (typeof feather !== 'undefined') feather.replace();
|
| 272 |
+
});
|
| 273 |
+
|
| 274 |
+
// Listen for cart updates from customizer
|
| 275 |
+
document.addEventListener('add-custom-build', (e) => {
|
| 276 |
+
const { id, name, price } = e.detail;
|
| 277 |
+
const existingItem = this.cartItems.find(item => item.id === id);
|
| 278 |
+
|
| 279 |
+
if (existingItem) {
|
| 280 |
+
existingItem.quantity++;
|
| 281 |
+
} else {
|
| 282 |
+
this.cartItems.push({ id, name, price, quantity: 1 });
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
this.updateCart();
|
| 286 |
+
this.render();
|
| 287 |
+
if (typeof feather !== 'undefined') feather.replace();
|
| 288 |
+
});
|
| 289 |
+
|
| 290 |
+
// Listen for cart toggles
|
| 291 |
+
document.addEventListener('open-cart', () => {
|
| 292 |
+
this.style.right = '0';
|
| 293 |
+
// Create overlay if not exists
|
| 294 |
+
let overlay = document.getElementById('cart-overlay');
|
| 295 |
+
if (!overlay) {
|
| 296 |
+
overlay = document.createElement('div');
|
| 297 |
+
overlay.id = 'cart-overlay';
|
| 298 |
+
overlay.className = 'fixed inset-0 bg-black/50 z-50 transition-opacity opacity-0 hidden';
|
| 299 |
+
overlay.style.backdropFilter = 'blur(4px)';
|
| 300 |
+
document.body.appendChild(overlay);
|
| 301 |
+
}
|
| 302 |
+
overlay.classList.remove('hidden');
|
| 303 |
+
setTimeout(() => overlay.classList.remove('opacity-0'), 10);
|
| 304 |
+
});
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
updateCart() {
|
| 308 |
+
localStorage.setItem('droneCart', JSON.stringify(this.cartItems));
|
| 309 |
+
// Dispatch event to update navbar count
|
| 310 |
+
document.dispatchEvent(new CustomEvent('cart-updated'));
|
| 311 |
+
}
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
customElements.define('drone-cart', DroneCart);
|
components/customizer.js
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class DroneCustomizer extends HTMLElement {
|
| 2 |
+
constructor() {
|
| 3 |
+
super();
|
| 4 |
+
this.selectedParts = {
|
| 5 |
+
frame: null,
|
| 6 |
+
motor: null,
|
| 7 |
+
controller: null,
|
| 8 |
+
camera: null,
|
| 9 |
+
battery: null,
|
| 10 |
+
propeller: null
|
| 11 |
+
};
|
| 12 |
+
this.totalPrice = 0;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
connectedCallback() {
|
| 16 |
+
this.attachShadow({ mode: 'open' });
|
| 17 |
+
this.render();
|
| 18 |
+
this.addEventListeners();
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
render() {
|
| 22 |
+
this.shadowRoot.innerHTML = `
|
| 23 |
+
<style>
|
| 24 |
+
:host {
|
| 25 |
+
display: block;
|
| 26 |
+
width: 100%;
|
| 27 |
+
font-family: 'Inter', sans-serif;
|
| 28 |
+
}
|
| 29 |
+
.customizer-container {
|
| 30 |
+
background: white;
|
| 31 |
+
border-radius: 1.5rem;
|
| 32 |
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
|
| 33 |
+
overflow: hidden;
|
| 34 |
+
}
|
| 35 |
+
.component-grid {
|
| 36 |
+
display: grid;
|
| 37 |
+
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
| 38 |
+
gap: 1.5rem;
|
| 39 |
+
}
|
| 40 |
+
.component-card {
|
| 41 |
+
border: 2px solid #e5e7eb;
|
| 42 |
+
border-radius: 1rem;
|
| 43 |
+
padding: 1.5rem;
|
| 44 |
+
cursor: pointer;
|
| 45 |
+
transition: all 0.3s ease;
|
| 46 |
+
background: white;
|
| 47 |
+
}
|
| 48 |
+
.component-card:hover {
|
| 49 |
+
transform: translateY(-4px);
|
| 50 |
+
box-shadow: 0 10px 30px rgba(59, 130, 246, 0.15);
|
| 51 |
+
}
|
| 52 |
+
.component-card.selected {
|
| 53 |
+
border-color: #3b82f6;
|
| 54 |
+
background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
|
| 55 |
+
}
|
| 56 |
+
.component-image {
|
| 57 |
+
height: 160px;
|
| 58 |
+
border-radius: 0.75rem;
|
| 59 |
+
overflow: hidden;
|
| 60 |
+
margin-bottom: 1rem;
|
| 61 |
+
background: #f8fafc;
|
| 62 |
+
}
|
| 63 |
+
.price-tag {
|
| 64 |
+
background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
|
| 65 |
+
color: white;
|
| 66 |
+
padding: 0.25rem 0.75rem;
|
| 67 |
+
border-radius: 9999px;
|
| 68 |
+
font-weight: 600;
|
| 69 |
+
font-size: 0.875rem;
|
| 70 |
+
}
|
| 71 |
+
.specs-list {
|
| 72 |
+
list-style: none;
|
| 73 |
+
padding: 0;
|
| 74 |
+
}
|
| 75 |
+
.specs-list li {
|
| 76 |
+
display: flex;
|
| 77 |
+
justify-content: space-between;
|
| 78 |
+
padding: 0.25rem 0;
|
| 79 |
+
border-bottom: 1px solid #f1f5f9;
|
| 80 |
+
}
|
| 81 |
+
.summary-card {
|
| 82 |
+
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
|
| 83 |
+
border-radius: 1rem;
|
| 84 |
+
padding: 2rem;
|
| 85 |
+
position: sticky;
|
| 86 |
+
top: 2rem;
|
| 87 |
+
}
|
| 88 |
+
.total-price {
|
| 89 |
+
font-size: 2.5rem;
|
| 90 |
+
font-weight: 800;
|
| 91 |
+
background: linear-gradient(135deg, #3b82f6 0%, #0ea5e9 100%);
|
| 92 |
+
-webkit-background-clip: text;
|
| 93 |
+
-webkit-text-fill-color: transparent;
|
| 94 |
+
}
|
| 95 |
+
.add-to-cart-btn {
|
| 96 |
+
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
|
| 97 |
+
color: white;
|
| 98 |
+
padding: 1rem 2rem;
|
| 99 |
+
border-radius: 0.75rem;
|
| 100 |
+
font-weight: 600;
|
| 101 |
+
transition: all 0.3s ease;
|
| 102 |
+
border: none;
|
| 103 |
+
width: 100%;
|
| 104 |
+
cursor: pointer;
|
| 105 |
+
}
|
| 106 |
+
.add-to-cart-btn:hover {
|
| 107 |
+
transform: translateY(-2px);
|
| 108 |
+
box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
|
| 109 |
+
}
|
| 110 |
+
.add-to-cart-btn:disabled {
|
| 111 |
+
opacity: 0.5;
|
| 112 |
+
cursor: not-allowed;
|
| 113 |
+
transform: none;
|
| 114 |
+
}
|
| 115 |
+
.component-category {
|
| 116 |
+
font-size: 1.5rem;
|
| 117 |
+
font-weight: 700;
|
| 118 |
+
color: #1e293b;
|
| 119 |
+
margin-bottom: 1.5rem;
|
| 120 |
+
padding-bottom: 0.5rem;
|
| 121 |
+
border-bottom: 3px solid #3b82f6;
|
| 122 |
+
display: inline-block;
|
| 123 |
+
}
|
| 124 |
+
@media (max-width: 768px) {
|
| 125 |
+
.component-grid {
|
| 126 |
+
grid-template-columns: 1fr;
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
</style>
|
| 130 |
+
<div class="customizer-container">
|
| 131 |
+
<div class="grid lg:grid-cols-3 gap-8 p-8">
|
| 132 |
+
<!-- Component Selector -->
|
| 133 |
+
<div class="lg:col-span-2 space-y-12">
|
| 134 |
+
<!-- Frame -->
|
| 135 |
+
<div>
|
| 136 |
+
<h3 class="component-category">
|
| 137 |
+
<i data-feather="box" class="inline mr-2"></i> Frame
|
| 138 |
+
</h3>
|
| 139 |
+
<div class="component-grid">
|
| 140 |
+
${this.renderComponentCards('frame', [
|
| 141 |
+
{ id: 'frame-1', name: 'X-Light Carbon', price: 299, specs: ['5" size', 'Carbon fiber', '120g', '3K weave'], img: 'http://static.photos/technology/320x240/501' },
|
| 142 |
+
{ id: 'frame-2', name: 'Titan Armor', price: 459, specs: ['6" size', 'Armored', '210g', 'Crash resistant'], img: 'http://static.photos/technology/320x240/502' },
|
| 143 |
+
{ id: 'frame-3', name: 'Stealth Pro', price: 699, specs: ['7" size', 'Military grade', '180g', 'Low radar profile'], img: 'http://static.photos/technology/320x240/503' }
|
| 144 |
+
])}
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
|
| 148 |
+
<!-- Motors -->
|
| 149 |
+
<div>
|
| 150 |
+
<h3 class="component-category">
|
| 151 |
+
<i data-feather="zap" class="inline mr-2"></i> Motores
|
| 152 |
+
</h3>
|
| 153 |
+
<div class="component-grid">
|
| 154 |
+
${this.renderComponentCards('motor', [
|
| 155 |
+
{ id: 'motor-1', name: 'Vortex 2207', price: 189, specs: ['2450KV', '4S-6S', '35A max', 'Neodymium'], img: 'http://static.photos/industry/320x240/511' },
|
| 156 |
+
{ id: 'motor-2', name: 'Titan 2806', price: 289, specs: ['1750KV', '6S-8S', '45A max', 'Industrial'], img: 'http://static.photos/industry/320x240/512' },
|
| 157 |
+
{ id: 'motor-3', name: 'Cyclone 2306', price: 239, specs: ['1950KV', '4S-6S', '40A max', 'High torque'], img: 'http://static.photos/industry/320x240/513' }
|
| 158 |
+
])}
|
| 159 |
+
</div>
|
| 160 |
+
</div>
|
| 161 |
+
|
| 162 |
+
<!-- Flight Controller -->
|
| 163 |
+
<div>
|
| 164 |
+
<h3 class="component-category">
|
| 165 |
+
<i data-feather="cpu" class="inline mr-2"></i> Controlador de Vuelo
|
| 166 |
+
</h3>
|
| 167 |
+
<div class="component-grid">
|
| 168 |
+
${this.renderComponentCards('controller', [
|
| 169 |
+
{ id: 'fc-1', name: 'Betaflight F7', price: 129, specs: ['F7 processor', '8 PWM', 'Blackbox', 'OSD'], img: 'http://static.photos/technology/320x240/521' },
|
| 170 |
+
{ id: 'fc-2', name: 'iNAV Pro', price: 199, specs: ['Triple IMU', 'GPS ready', 'Autonomous', 'Return home'], img: 'http://static.photos/technology/320x240/522' },
|
| 171 |
+
{ id: 'fc-3', name: 'Ardupilot Military', price: 599, specs: ['Encrypted', 'Waypoints', 'Thermal cam', 'Secure comms'], img: 'http://static.photos/technology/320x240/523' }
|
| 172 |
+
])}
|
| 173 |
+
</div>
|
| 174 |
+
</div>
|
| 175 |
+
|
| 176 |
+
<!-- Camera -->
|
| 177 |
+
<div>
|
| 178 |
+
<h3 class="component-category">
|
| 179 |
+
<i data-feather="video" class="inline mr-2"></i> Cámara
|
| 180 |
+
</h3>
|
| 181 |
+
<div class="component-grid">
|
| 182 |
+
${this.renderComponentCards('camera', [
|
| 183 |
+
{ id: 'cam-1', name: 'Foxeer 4K', price: 159, specs: ['4K 60fps', 'Superview', 'Gyro flow', 'Low light'], img: 'http://static.photos/technology/320x240/531' },
|
| 184 |
+
{ id: 'cam-2', name: 'DJI O3 Air', price: 239, specs: ['4K 120fps', '10-bit', '50km range', 'HD low latency'], img: 'http://static.photos/technology/320x240/532' },
|
| 185 |
+
{ id: 'cam-3', name: 'Thermal FLIR', price: 1299, specs: ['Thermal 640x512', 'Zoom 30x', 'Night vision', 'Military spec'], img: 'http://static.photos/technology/320x240/533' }
|
| 186 |
+
])}
|
| 187 |
+
</div>
|
| 188 |
+
</div>
|
| 189 |
+
|
| 190 |
+
<!-- Battery -->
|
| 191 |
+
<div>
|
| 192 |
+
<h3 class="component-category">
|
| 193 |
+
<i data-feather="battery" class="inline mr-2"></i> Batería
|
| 194 |
+
</h3>
|
| 195 |
+
<div class="component-grid">
|
| 196 |
+
${this.renderComponentCards('battery', [
|
| 197 |
+
{ id: 'bat-1', name: 'CNHL 6S 1300mAh', price: 89, specs: ['1300mAh', '6S 100C', 'XT60', 'Lightweight'], img: 'http://static.photos/technology/320x240/541' },
|
| 198 |
+
{ id: 'bat-2', name: 'Tattu 6S 1800mAh', price: 129, specs: ['1800mAh', '6S 120C', 'XT90', 'Long flight'], img: 'http://static.photos/technology/320x240/542' },
|
| 199 |
+
{ id: 'bat-3', name: 'Military 8S 2500mAh', price: 299, specs: ['2500mAh', '8S 150C', 'Anti-EMP', 'Wide temp'], img: 'http://static.photos/technology/320x240/543' }
|
| 200 |
+
])}
|
| 201 |
+
</div>
|
| 202 |
+
</div>
|
| 203 |
+
|
| 204 |
+
<!-- Propellers -->
|
| 205 |
+
<div>
|
| 206 |
+
<h3 class="component-category">
|
| 207 |
+
<i data-feather="wind" class="inline mr-2"></i> Hélices
|
| 208 |
+
</h3>
|
| 209 |
+
<div class="component-grid">
|
| 210 |
+
${this.renderComponentCards('propeller', [
|
| 211 |
+
{ id: 'prop-1', name: 'Gemfan 51466', price: 29, specs: ['3-blade', '5.1" pitch', '66mm', 'Durable'], img: 'http://static.photos/abstract/320x240/551' },
|
| 212 |
+
{ id: 'prop-2', name: 'HQProp 6040', price: 39, specs: ['4-blade', '6" pitch', '40mm', 'Efficient'], img: 'http://static.photos/abstract/320x240/552' },
|
| 213 |
+
{ id: 'prop-3', name: 'Stealth Whisper', price: 59, specs: ['5-blade', 'Silent', 'Carbon', 'Military'], img: 'http://static.photos/abstract/320x240/553' }
|
| 214 |
+
])}
|
| 215 |
+
</div>
|
| 216 |
+
</div>
|
| 217 |
+
</div>
|
| 218 |
+
|
| 219 |
+
<!-- Summary Sidebar -->
|
| 220 |
+
<div class="summary-card h-fit">
|
| 221 |
+
<h3 class="text-2xl font-bold mb-6">Tu Configuración</h3>
|
| 222 |
+
|
| 223 |
+
<div class="space-y-4 mb-8">
|
| 224 |
+
${Object.entries(this.selectedParts).map(([category, part]) => `
|
| 225 |
+
<div class="flex justify-between items-center p-3 bg-white rounded-lg">
|
| 226 |
+
<span class="font-medium capitalize">${category}</span>
|
| 227 |
+
<span class="font-semibold">${part ? part.name : 'No seleccionado'}</span>
|
| 228 |
+
${part ? `<span class="font-bold text-primary">$${part.price}</span>` : ''}
|
| 229 |
+
</div>
|
| 230 |
+
`).join('')}
|
| 231 |
+
</div>
|
| 232 |
+
|
| 233 |
+
<div class="border-t pt-6">
|
| 234 |
+
<div class="flex justify-between items-center mb-2">
|
| 235 |
+
<span class="text-lg font-semibold">Subtotal:</span>
|
| 236 |
+
<span class="text-xl font-bold" id="subtotal">$0</span>
|
| 237 |
+
</div>
|
| 238 |
+
<div class="flex justify-between items-center mb-2">
|
| 239 |
+
<span class="text-lg font-semibold">Envío:</span>
|
| 240 |
+
<span class="text-xl font-bold">$99</span>
|
| 241 |
+
</div>
|
| 242 |
+
<div class="flex justify-between items-center mb-6 border-t pt-4">
|
| 243 |
+
<span class="text-2xl font-extrabold">Total:</span>
|
| 244 |
+
<span class="total-price" id="total-price">$0</span>
|
| 245 |
+
</div>
|
| 246 |
+
|
| 247 |
+
<button id="add-custom-to-cart" class="add-to-cart-btn" disabled>
|
| 248 |
+
<i data-feather="shopping-cart" class="inline mr-2"></i>
|
| 249 |
+
Agregar al Carro
|
| 250 |
+
</button>
|
| 251 |
+
|
| 252 |
+
<p class="text-sm text-gray-500 mt-4 text-center">
|
| 253 |
+
<i data-feather="shield" class="inline w-4 h-4 mr-1"></i>
|
| 254 |
+
2 años de garantía incluida
|
| 255 |
+
</p>
|
| 256 |
+
</div>
|
| 257 |
+
</div>
|
| 258 |
+
</div>
|
| 259 |
+
</div>
|
| 260 |
+
`;
|
| 261 |
+
|
| 262 |
+
if (typeof feather !== 'undefined') {
|
| 263 |
+
feather.replace();
|
| 264 |
+
}
|
| 265 |
+
this.updateSummary();
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
renderComponentCards(category, components) {
|
| 269 |
+
return components.map(component => `
|
| 270 |
+
<div class="component-card ${this.selectedParts[category]?.id === component.id ? 'selected' : ''}"
|
| 271 |
+
data-category="${category}"
|
| 272 |
+
data-id="${component.id}"
|
| 273 |
+
data-name="${component.name}"
|
| 274 |
+
data-price="${component.price}">
|
| 275 |
+
<div class="component-image">
|
| 276 |
+
<img src="${component.img}" alt="${component.name}" class="w-full h-full object-cover">
|
| 277 |
+
</div>
|
| 278 |
+
<div class="flex justify-between items-start mb-3">
|
| 279 |
+
<h4 class="font-bold text-lg">${component.name}</h4>
|
| 280 |
+
<span class="price-tag">$${component.price}</span>
|
| 281 |
+
</div>
|
| 282 |
+
<ul class="specs-list text-sm text-gray-600">
|
| 283 |
+
${component.specs.map(spec => `<li><span>${spec}</span></li>`).join('')}
|
| 284 |
+
</ul>
|
| 285 |
+
</div>
|
| 286 |
+
`).join('');
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
addEventListeners() {
|
| 290 |
+
this.shadowRoot.addEventListener('click', (e) => {
|
| 291 |
+
const card = e.target.closest('.component-card');
|
| 292 |
+
if (card) {
|
| 293 |
+
const category = card.dataset.category;
|
| 294 |
+
const id = card.dataset.id;
|
| 295 |
+
const name = card.dataset.name;
|
| 296 |
+
const price = parseInt(card.dataset.price);
|
| 297 |
+
|
| 298 |
+
this.selectComponent(category, { id, name, price });
|
| 299 |
+
this.updateSummary();
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
if (e.target.id === 'add-custom-to-cart' || e.target.closest('#add-custom-to-cart')) {
|
| 303 |
+
this.addCustomBuildToCart();
|
| 304 |
+
}
|
| 305 |
+
});
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
selectComponent(category, component) {
|
| 309 |
+
this.selectedParts[category] = component;
|
| 310 |
+
|
| 311 |
+
// Update UI
|
| 312 |
+
const cards = this.shadowRoot.querySelectorAll(`[data-category="${category}"]`);
|
| 313 |
+
cards.forEach(card => {
|
| 314 |
+
card.classList.remove('selected');
|
| 315 |
+
if (card.dataset.id === component.id) {
|
| 316 |
+
card.classList.add('selected');
|
| 317 |
+
}
|
| 318 |
+
});
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
updateSummary() {
|
| 322 |
+
// Calculate subtotal
|
| 323 |
+
this.totalPrice = Object.values(this.selectedParts)
|
| 324 |
+
.filter(part => part !== null)
|
| 325 |
+
.reduce((total, part) => total + part.price, 0);
|
| 326 |
+
|
| 327 |
+
const subtotalEl = this.shadowRoot.getElementById('subtotal');
|
| 328 |
+
const totalEl = this.shadowRoot.getElementById('total-price');
|
| 329 |
+
const cartBtn = this.shadowRoot.getElementById('add-custom-to-cart');
|
| 330 |
+
|
| 331 |
+
if (subtotalEl) subtotalEl.textContent = `$${this.totalPrice}`;
|
| 332 |
+
if (totalEl) totalEl.textContent = `$${this.totalPrice + 99}`;
|
| 333 |
+
|
| 334 |
+
// Enable/disable cart button
|
| 335 |
+
const allSelected = Object.values(this.selectedParts).every(part => part !== null);
|
| 336 |
+
if (cartBtn) {
|
| 337 |
+
cartBtn.disabled = !allSelected;
|
| 338 |
+
}
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
addCustomBuildToCart() {
|
| 342 |
+
if (!Object.values(this.selectedParts).every(part => part !== null)) {
|
| 343 |
+
alert('Por favor selecciona todos los componentes antes de agregar al carro.');
|
| 344 |
+
return;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
// Generate a unique build name
|
| 348 |
+
const buildName = `Drone Personalizado: ${this.selectedParts.frame.name} + ${this.selectedParts.motor.name}`;
|
| 349 |
+
const totalPrice = this.totalPrice + 99;
|
| 350 |
+
|
| 351 |
+
// Add to cart
|
| 352 |
+
const event = new CustomEvent('add-custom-build', {
|
| 353 |
+
detail: {
|
| 354 |
+
id: `custom-${Date.now()}`,
|
| 355 |
+
name: buildName,
|
| 356 |
+
price: totalPrice,
|
| 357 |
+
parts: this.selectedParts
|
| 358 |
+
}
|
| 359 |
+
});
|
| 360 |
+
document.dispatchEvent(event);
|
| 361 |
+
|
| 362 |
+
// Show success message
|
| 363 |
+
alert(`✓ ${buildName} agregado al carro por $${totalPrice}`);
|
| 364 |
+
}
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
customElements.define('drone-customizer', DroneCustomizer);
|
components/footer.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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{
|
| 7 |
+
this.attachShadow({ mode: 'open' });
|
| 8 |
+
this.shadowRoot.innerHTML = `
|
| 9 |
+
<style>
|
| 10 |
+
:host {
|
| 11 |
+
display: block;
|
| 12 |
+
width: 100%;
|
| 13 |
+
font-family: 'Inter', sans-serif;
|
| 14 |
+
}
|
| 15 |
+
footer {
|
| 16 |
+
background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
|
| 17 |
+
color: white;
|
| 18 |
+
}
|
| 19 |
+
.footer-container {
|
| 20 |
+
max-width: 1280px;
|
| 21 |
+
margin: 0 auto;
|
| 22 |
+
}
|
| 23 |
+
.footer-link {
|
| 24 |
+
transition: color 0.3s ease;
|
| 25 |
+
}
|
| 26 |
+
.footer-link:hover {
|
| 27 |
+
color: #60a5fa;
|
| 28 |
+
}
|
| 29 |
+
.social-icon {
|
| 30 |
+
transition: all 0.3s ease;
|
| 31 |
+
}
|
| 32 |
+
.social-icon:hover {
|
| 33 |
+
transform: translateY(-3px);
|
| 34 |
+
color: #60a5fa;
|
| 35 |
+
}
|
| 36 |
+
.newsletter-input {
|
| 37 |
+
background: rgba(255, 255, 255, 0.1);
|
| 38 |
+
backdrop-filter: blur(10px);
|
| 39 |
+
}
|
| 40 |
+
.newsletter-input:focus {
|
| 41 |
+
outline: none;
|
| 42 |
+
ring: 2px;
|
| 43 |
+
ring-color: #3b82f6;
|
| 44 |
+
}
|
| 45 |
+
@media (max-width: 768px) {
|
| 46 |
+
.footer-grid {
|
| 47 |
+
grid-template-columns: 1fr;
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
</style>
|
| 51 |
+
<footer class="pt-16 pb-8">
|
| 52 |
+
<div class="footer-container px-4">
|
| 53 |
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-12 footer-grid">
|
| 54 |
+
<!-- Company Info -->
|
| 55 |
+
<div>
|
| 56 |
+
<div class="flex items-center space-x-2 mb-6">
|
| 57 |
+
<i data-feather="navigation" class="w-8 h-8 text-blue-400"></i>
|
| 58 |
+
<span class="text-2xl font-bold">DronesLibres.ai</span>
|
| 59 |
+
</div>
|
| 60 |
+
<p class="text-gray-400 mb-6">
|
| 61 |
+
Líderes en drones FPV personalizados para todos los sectores.
|
| 62 |
+
Tecnología, innovación y libertad de vuelo.
|
| 63 |
+
</p>
|
| 64 |
+
<div class="flex space-x-4">
|
| 65 |
+
<a href="#" class="social-icon text-gray-400 hover:text-white">
|
| 66 |
+
<i data-feather="facebook" class="w-5 h-5"></i>
|
| 67 |
+
</a>
|
| 68 |
+
<a href="#" class="social-icon text-gray-400 hover:text-white">
|
| 69 |
+
<i data-feather="twitter" class="w-5 h-5"></i>
|
| 70 |
+
</a>
|
| 71 |
+
<a href="#" class="social-icon text-gray-400 hover:text-white">
|
| 72 |
+
<i data-feather="instagram" class="w-5 h-5"></i>
|
| 73 |
+
</a>
|
| 74 |
+
<a href="#" class="social-icon text-gray-400 hover:text-white">
|
| 75 |
+
<i data-feather="youtube" class="w-5 h-5"></i>
|
| 76 |
+
</a>
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
|
| 80 |
+
<!-- Quick Links -->
|
| 81 |
+
<div>
|
| 82 |
+
<h3 class="text-xl font-bold mb-6">Enlaces Rápidos</h3>
|
| 83 |
+
<ul class="space-y-3">
|
| 84 |
+
<li><a href="/" class="footer-link text-gray-400 hover:text-white">Inicio</a></li>
|
| 85 |
+
<li><a href="#personalizar" class="footer-link text-gray-400 hover:text-white">Personalizar Drone</a></li>
|
| 86 |
+
<li><a href="/civil.html" class="footer-link text-gray-400 hover:text-white">Drones Civiles</a></li>
|
| 87 |
+
<li><a href="/comercial.html" class="footer-link text-gray-400 hover:text-white">Drones Comerciales</a></li>
|
| 88 |
+
<li><a href="/agricola.html" class="footer-link text-gray-400 hover:text-white">Drones Agrícolas</a></li>
|
| 89 |
+
<li><a href="/militar.html" class="footer-link text-gray-400 hover:text-white">Drones Militares</a></li>
|
| 90 |
+
</ul>
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
<!-- Support -->
|
| 94 |
+
<div>
|
| 95 |
+
<h3 class="text-xl font-bold mb-6">Soporte</h3>
|
| 96 |
+
<ul class="space-y-3">
|
| 97 |
+
<li><a href="/contacto.html" class="footer-link text-gray-400 hover:text-white">Contacto</a></li>
|
| 98 |
+
<li><a href="/faq.html" class="footer-link text-gray-400 hover:text-white">Preguntas Frecuentes</a></li>
|
| 99 |
+
<li><a href="/envios.html" class="footer-link text-gray-400 hover:text-white">Envíos & Devoluciones</a></li>
|
| 100 |
+
<li><a href="/garantia.html" class="footer-link text-gray-400 hover:text-white">Garantía</a></li>
|
| 101 |
+
<li><a href="/soporte.html" class="footer-link text-gray-400 hover:text-white">Soporte Técnico</a></li>
|
| 102 |
+
<li><a href="/terminos.html" class="footer-link text-gray-400 hover:text-white">Términos & Condiciones</a></li>
|
| 103 |
+
</ul>
|
| 104 |
+
</div>
|
| 105 |
+
|
| 106 |
+
<!-- Newsletter -->
|
| 107 |
+
<div>
|
| 108 |
+
<h3 class="text-xl font-bold mb-6">Mantente Informado</h3>
|
| 109 |
+
<p class="text-gray-400 mb-4">
|
| 110 |
+
Suscríbete para recibir noticias sobre nuevos productos y ofertas exclusivas.
|
| 111 |
+
</p>
|
| 112 |
+
<form id="newsletter-form" class="space-y-3">
|
| 113 |
+
<input type="email"
|
| 114 |
+
placeholder="tu@email.com"
|
| 115 |
+
class="newsletter-input w-full px-4 py-3 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
| 116 |
+
required>
|
| 117 |
+
<button type="submit"
|
| 118 |
+
class="w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-3 px-6 rounded-lg transition duration-300">
|
| 119 |
+
Suscribirse
|
| 120 |
+
</button>
|
| 121 |
+
</form>
|
| 122 |
+
<p class="text-xs text-gray-500 mt-3">
|
| 123 |
+
No compartiremos tu email. Puedes darte de baja en cualquier momento.
|
| 124 |
+
</p>
|
| 125 |
+
</div>
|
| 126 |
+
</div>
|
| 127 |
+
|
| 128 |
+
<!-- Divider -->
|
| 129 |
+
<div class="border-t border-gray-800 my-8"></div>
|
| 130 |
+
|
| 131 |
+
<!-- Bottom Bar -->
|
| 132 |
+
<div class="flex flex-col md:flex-row justify-between items-center">
|
| 133 |
+
<p class="text-gray-500 text-sm">
|
| 134 |
+
© 2024 DronesLibres.ai. Todos los derechos reservados.
|
| 135 |
+
</p>
|
| 136 |
+
<div class="flex space-x-6 mt-4 md:mt-0">
|
| 137 |
+
<a href="#" class="text-gray-500 hover:text-white text-sm">Privacidad</a>
|
| 138 |
+
<a href="#" class="text-gray-500 hover:text-white text-sm">Términos</a>
|
| 139 |
+
<a href="#" class="text-gray-500 hover:text-white text-sm">Cookies</a>
|
| 140 |
+
<a href="#" class="text-gray-500 hover:text-white text-sm">Mapa del Sitio</a>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
</div>
|
| 144 |
+
</footer>
|
| 145 |
+
`;
|
| 146 |
+
|
| 147 |
+
// Initialize Feather Icons
|
| 148 |
+
if (typeof feather !== 'undefined') {
|
| 149 |
+
feather.replace();
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
// Add event listeners
|
| 153 |
+
this.addEventListeners();
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
addEventListeners() {
|
| 157 |
+
const newsletterForm = this.shadowRoot.getElementById('newsletter-form');
|
| 158 |
+
if (newsletterForm) {
|
| 159 |
+
newsletterForm.addEventListener('submit', (e) => {
|
| 160 |
+
e.preventDefault();
|
| 161 |
+
const email = newsletterForm.querySelector('input[type="email"]').value;
|
| 162 |
+
|
| 163 |
+
// Simple validation
|
| 164 |
+
if (email && email.includes('@')) {
|
| 165 |
+
// In a real app, you would send this to your backend
|
| 166 |
+
newsletterForm.innerHTML = `
|
| 167 |
+
<div class="bg-green-500/20 border border-green-500 text-green-400 px-4 py-3 rounded-lg">
|
| 168 |
+
<p class="font-semibold">¡Gracias por suscribirte!</p>
|
| 169 |
+
<p class="text-sm">Te hemos enviado un correo de confirmación.</p>
|
| 170 |
+
</div>
|
| 171 |
+
`;
|
| 172 |
+
}
|
| 173 |
+
});
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
customElements.define('drone-footer', DroneFooter);
|
components/navbar.js
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class DroneNavbar extends HTMLElement {
|
| 2 |
+
constructor() {
|
| 3 |
+
super();
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
connectedCallback() {
|
| 7 |
+
this.attachShadow({ mode: 'open' });
|
| 8 |
+
this.shadowRoot.innerHTML = `
|
| 9 |
+
<style>
|
| 10 |
+
:host {
|
| 11 |
+
display: block;
|
| 12 |
+
width: 100%;
|
| 13 |
+
position: fixed;
|
| 14 |
+
top: 0;
|
| 15 |
+
left: 0;
|
| 16 |
+
z-index: 1000;
|
| 17 |
+
font-family: 'Inter', sans-serif;
|
| 18 |
+
}
|
| 19 |
+
nav {
|
| 20 |
+
background: rgba(255, 255, 255, 0.95);
|
| 21 |
+
backdrop-filter: blur(10px);
|
| 22 |
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
|
| 23 |
+
border-bottom: 1px solid rgba(59, 130, 246, 0.1);
|
| 24 |
+
}
|
| 25 |
+
.nav-container {
|
| 26 |
+
max-width: 1280px;
|
| 27 |
+
margin: 0 auto;
|
| 28 |
+
}
|
| 29 |
+
.logo {
|
| 30 |
+
font-weight: 800;
|
| 31 |
+
font-size: 1.75rem;
|
| 32 |
+
background: linear-gradient(135deg, #3b82f6 0%, #0ea5e9 100%);
|
| 33 |
+
-webkit-background-clip: text;
|
| 34 |
+
-webkit-text-fill-color: transparent;
|
| 35 |
+
}
|
| 36 |
+
.nav-link {
|
| 37 |
+
position: relative;
|
| 38 |
+
transition: color 0.3s ease;
|
| 39 |
+
}
|
| 40 |
+
.nav-link:hover {
|
| 41 |
+
color: #3b82f6;
|
| 42 |
+
}
|
| 43 |
+
.nav-link::after {
|
| 44 |
+
content: '';
|
| 45 |
+
position: absolute;
|
| 46 |
+
bottom: -4px;
|
| 47 |
+
left: 0;
|
| 48 |
+
width: 0;
|
| 49 |
+
height: 2px;
|
| 50 |
+
background: #3b82f6;
|
| 51 |
+
transition: width 0.3s ease;
|
| 52 |
+
}
|
| 53 |
+
.nav-link:hover::after {
|
| 54 |
+
width: 100%;
|
| 55 |
+
}
|
| 56 |
+
.cart-badge {
|
| 57 |
+
position: absolute;
|
| 58 |
+
top: -8px;
|
| 59 |
+
right: -8px;
|
| 60 |
+
background: #ef4444;
|
| 61 |
+
color: white;
|
| 62 |
+
border-radius: 50%;
|
| 63 |
+
width: 20px;
|
| 64 |
+
height: 20px;
|
| 65 |
+
font-size: 0.75rem;
|
| 66 |
+
display: flex;
|
| 67 |
+
align-items: center;
|
| 68 |
+
justify-content: center;
|
| 69 |
+
}
|
| 70 |
+
.mobile-menu {
|
| 71 |
+
transform: translateY(-100%);
|
| 72 |
+
transition: transform 0.3s ease;
|
| 73 |
+
}
|
| 74 |
+
.mobile-menu.active {
|
| 75 |
+
transform: translateY(0);
|
| 76 |
+
}
|
| 77 |
+
@media (max-width: 768px) {
|
| 78 |
+
.nav-links {
|
| 79 |
+
display: none;
|
| 80 |
+
}
|
| 81 |
+
.mobile-menu {
|
| 82 |
+
display: block;
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
</style>
|
| 86 |
+
<nav class="py-4">
|
| 87 |
+
<div class="nav-container px-4 flex justify-between items-center">
|
| 88 |
+
<!-- Logo -->
|
| 89 |
+
<a href="/" class="logo flex items-center space-x-2">
|
| 90 |
+
<i data-feather="navigation" class="w-8 h-8 text-blue-500"></i>
|
| 91 |
+
<span>DronesLibres.ai</span>
|
| 92 |
+
</a>
|
| 93 |
+
|
| 94 |
+
<!-- Desktop Navigation -->
|
| 95 |
+
<div class="nav-links hidden md:flex items-center space-x-8">
|
| 96 |
+
<a href="/" class="nav-link text-gray-700 font-medium">Inicio</a>
|
| 97 |
+
<a href="/civil.html" class="nav-link text-gray-700 font-medium">Civil</a>
|
| 98 |
+
<a href="/comercial.html" class="nav-link text-gray-700 font-medium">Comercial</a>
|
| 99 |
+
<a href="/agricola.html" class="nav-link text-gray-700 font-medium">Agrícola</a>
|
| 100 |
+
<a href="/militar.html" class="nav-link text-gray-700 font-medium">Militar</a>
|
| 101 |
+
<a href="#personalizar" class="nav-link text-gray-700 font-medium">Personalizar</a>
|
| 102 |
+
<a href="/nosotros.html" class="nav-link text-gray-700 font-medium">Nosotros</a>
|
| 103 |
+
<a href="/contacto.html" class="nav-link text-gray-700 font-medium">Contacto</a>
|
| 104 |
+
|
| 105 |
+
<!-- Cart Icon -->
|
| 106 |
+
<div class="relative">
|
| 107 |
+
<button id="cart-toggle" class="p-2 hover:bg-gray-100 rounded-full transition">
|
| 108 |
+
<i data-feather="shopping-cart" class="w-6 h-6 text-gray-700"></i>
|
| 109 |
+
<span id="cart-count" class="cart-badge">0</span>
|
| 110 |
+
</button>
|
| 111 |
+
</div>
|
| 112 |
+
</div>
|
| 113 |
+
|
| 114 |
+
<!-- Mobile Menu Button -->
|
| 115 |
+
<button id="mobile-menu-button" class="md:hidden p-2 hover:bg-gray-100 rounded">
|
| 116 |
+
<i data-feather="menu" class="w-6 h-6 text-gray-700"></i>
|
| 117 |
+
</button>
|
| 118 |
+
</div>
|
| 119 |
+
|
| 120 |
+
<!-- Mobile Menu -->
|
| 121 |
+
<div id="mobile-menu" class="mobile-menu absolute top-full left-0 w-full bg-white shadow-lg md:hidden">
|
| 122 |
+
<div class="flex flex-col p-4 space-y-4">
|
| 123 |
+
<a href="/" class="py-3 px-4 hover:bg-gray-50 rounded-lg font-medium">Inicio</a>
|
| 124 |
+
<a href="/civil.html" class="py-3 px-4 hover:bg-gray-50 rounded-lg font-medium">Civil</a>
|
| 125 |
+
<a href="/comercial.html" class="py-3 px-4 hover:bg-gray-50 rounded-lg font-medium">Comercial</a>
|
| 126 |
+
<a href="/agricola.html" class="py-3 px-4 hover:bg-gray-50 rounded-lg font-medium">Agrícola</a>
|
| 127 |
+
<a href="/militar.html" class="py-3 px-4 hover:bg-gray-50 rounded-lg font-medium">Militar</a>
|
| 128 |
+
<a href="#personalizar" class="py-3 px-4 hover:bg-gray-50 rounded-lg font-medium">Personalizar</a>
|
| 129 |
+
<a href="/nosotros.html" class="py-3 px-4 hover:bg-gray-50 rounded-lg font-medium">Nosotros</a>
|
| 130 |
+
<a href="/contacto.html" class="py-3 px-4 hover:bg-gray-50 rounded-lg font-medium">Contacto</a>
|
| 131 |
+
<div class="pt-4 border-t">
|
| 132 |
+
<button id="cart-toggle-mobile" class="w-full flex items-center justify-center py-3 bg-primary text-white rounded-lg font-medium">
|
| 133 |
+
<i data-feather="shopping-cart" class="w-5 h-5 mr-2"></i>
|
| 134 |
+
Carro (<span id="cart-count-mobile">0</span>)
|
| 135 |
+
</button>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
</nav>
|
| 140 |
+
`;
|
| 141 |
+
|
| 142 |
+
// Initialize Feather Icons
|
| 143 |
+
if (typeof feather !== 'undefined') {
|
| 144 |
+
feather.replace();
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
// Add event listeners
|
| 148 |
+
this.addEventListeners();
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
addEventListeners() {
|
| 152 |
+
// Mobile menu toggle
|
| 153 |
+
const mobileMenuButton = this.shadowRoot.getElementById('mobile-menu-button');
|
| 154 |
+
const mobileMenu = this.shadowRoot.getElementById('mobile-menu');
|
| 155 |
+
const cartToggleMobile = this.shadowRoot.getElementById('cart-toggle-mobile');
|
| 156 |
+
|
| 157 |
+
if (mobileMenuButton) {
|
| 158 |
+
mobileMenuButton.addEventListener('click', () => {
|
| 159 |
+
mobileMenu.classList.toggle('active');
|
| 160 |
+
const icon = mobileMenuButton.querySelector('i');
|
| 161 |
+
if (mobileMenu.classList.contains('active')) {
|
| 162 |
+
icon.setAttribute('data-feather', 'x');
|
| 163 |
+
} else {
|
| 164 |
+
icon.setAttribute('data-feather', 'menu');
|
| 165 |
+
}
|
| 166 |
+
feather.replace();
|
| 167 |
+
});
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
if (cartToggleMobile) {
|
| 171 |
+
cartToggleMobile.addEventListener('click', () => {
|
| 172 |
+
// Dispatch event to open cart
|
| 173 |
+
document.dispatchEvent(new CustomEvent('open-cart'));
|
| 174 |
+
mobileMenu.classList.remove('active');
|
| 175 |
+
const icon = mobileMenuButton.querySelector('i');
|
| 176 |
+
icon.setAttribute('data-feather', 'menu');
|
| 177 |
+
feather.replace();
|
| 178 |
+
});
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
// Close mobile menu when clicking outside
|
| 182 |
+
document.addEventListener('click', (e) => {
|
| 183 |
+
if (!this.contains(e.target) && !e.target.closest('drone-navbar')) {
|
| 184 |
+
mobileMenu.classList.remove('active');
|
| 185 |
+
const icon = this.shadowRoot.querySelector('#mobile-menu-button i');
|
| 186 |
+
if (icon) {
|
| 187 |
+
icon.setAttribute('data-feather', 'menu');
|
| 188 |
+
feather.replace();
|
| 189 |
+
}
|
| 190 |
+
}
|
| 191 |
+
});
|
| 192 |
+
|
| 193 |
+
// Update cart count
|
| 194 |
+
this.updateCartCount();
|
| 195 |
+
|
| 196 |
+
// Listen for cart updates
|
| 197 |
+
document.addEventListener('cart-updated', () => {
|
| 198 |
+
this.updateCartCount();
|
| 199 |
+
});
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
updateCartCount() {
|
| 203 |
+
const cart = JSON.parse(localStorage.getItem('droneCart')) || [];
|
| 204 |
+
const count = cart.reduce((total, item) => total + item.quantity, 0);
|
| 205 |
+
|
| 206 |
+
const cartCount = this.shadowRoot.getElementById('cart-count');
|
| 207 |
+
const cartCountMobile = this.shadowRoot.getElementById('cart-count-mobile');
|
| 208 |
+
|
| 209 |
+
if (cartCount) cartCount.textContent = count;
|
| 210 |
+
if (cartCountMobile) cartCountMobile.textContent = count;
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
customElements.define('drone-navbar', DroneNavbar);
|
index.html
CHANGED
|
@@ -1,19 +1,204 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="es">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>DronesLibres.ai - FPV Drones Personalizados</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
+
<link rel="stylesheet" href="style.css">
|
| 9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 12 |
+
<!-- Tailwind Configuration -->
|
| 13 |
+
<script>
|
| 14 |
+
tailwind.config = {
|
| 15 |
+
theme: {
|
| 16 |
+
extend: {
|
| 17 |
+
colors: {
|
| 18 |
+
primary: '#3b82f6',
|
| 19 |
+
secondary: '#10b981',
|
| 20 |
+
drone: '#0ea5e9',
|
| 21 |
+
military: '#ef4444',
|
| 22 |
+
commercial: '#f59e0b',
|
| 23 |
+
civilian: '#10b981',
|
| 24 |
+
agricultural: '#22c55e'
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
</script>
|
| 30 |
+
</head>
|
| 31 |
+
<body class="bg-gray-50 text-gray-900">
|
| 32 |
+
<!-- Navigation -->
|
| 33 |
+
<drone-navbar></drone-navbar>
|
| 34 |
+
|
| 35 |
+
<!-- Hero Section -->
|
| 36 |
+
<section class="relative h-screen flex items-center justify-center overflow-hidden">
|
| 37 |
+
<div class="absolute inset-0 z-0">
|
| 38 |
+
<img src="http://static.photos/technology/1920x1080/101" alt="FPV Drone Hero" class="w-full h-full object-cover opacity-30">
|
| 39 |
+
<div class="absolute inset-0 bg-gradient-to-r from-primary/80 to-secondary/80"></div>
|
| 40 |
+
</div>
|
| 41 |
+
<div class="container mx-auto px-4 z-10 text-center">
|
| 42 |
+
<h1 class="text-5xl md:text-7xl font-bold mb-6 text-white">
|
| 43 |
+
Construye tu <span class="text-drone">Drone FPV</span> Ideal
|
| 44 |
+
</h1>
|
| 45 |
+
<p class="text-xl md:text-2xl mb-10 text-gray-100 max-w-3xl mx-auto">
|
| 46 |
+
Desde civiles hasta militares, personaliza cada componente y lleva tu experiencia de vuelo al límite.
|
| 47 |
+
Envíos a toda Latinoamérica.
|
| 48 |
+
</p>
|
| 49 |
+
<div class="flex flex-wrap gap-4 justify-center">
|
| 50 |
+
<a href="#personalizar" class="bg-drone hover:bg-blue-600 text-white px-8 py-4 rounded-lg text-lg font-semibold transition duration-300 transform hover:scale-105">
|
| 51 |
+
<i data-feather="package" class="inline mr-2"></i> Personalizar Ahora
|
| 52 |
+
</a>
|
| 53 |
+
<a href="#categorias" class="bg-white/20 backdrop-blur-sm hover:bg-white/30 text-white px-8 py-4 rounded-lg text-lg font-semibold border border-white/30 transition duration-300">
|
| 54 |
+
<i data-feather="grid" class="inline mr-2"></i> Ver Categorías
|
| 55 |
+
</a>
|
| 56 |
+
</div>
|
| 57 |
+
</div>
|
| 58 |
+
<div class="absolute bottom-10 left-1/2 transform -translate-x-1/2">
|
| 59 |
+
<a href="#categorias" class="text-white animate-bounce">
|
| 60 |
+
<i data-feather="chevron-down" class="w-10 h-10"></i>
|
| 61 |
+
</a>
|
| 62 |
+
</div>
|
| 63 |
+
</section>
|
| 64 |
+
|
| 65 |
+
<!-- Categories Section -->
|
| 66 |
+
<section id="categorias" class="py-20 bg-gradient-to-b from-white to-gray-100">
|
| 67 |
+
<div class="container mx-auto px-4">
|
| 68 |
+
<h2 class="text-4xl font-bold text-center mb-16">Categorías de Uso</h2>
|
| 69 |
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8">
|
| 70 |
+
<div class="bg-white rounded-2xl shadow-xl p-8 transform hover:-translate-y-2 transition duration-300 border-t-4 border-civilian">
|
| 71 |
+
<div class="bg-civilian/10 w-16 h-16 rounded-full flex items-center justify-center mb-6">
|
| 72 |
+
<i data-feather="home" class="text-civilian w-8 h-8"></i>
|
| 73 |
+
</div>
|
| 74 |
+
<h3 class="text-2xl font-bold mb-4 text-civilian">Civil & Recreativo</h3>
|
| 75 |
+
<p class="text-gray-600 mb-6">Drones para aficionados, filmación y vuelo libre. Perfectos para empezar.</p>
|
| 76 |
+
<a href="/civil.html" class="text-civilian font-semibold inline-flex items-center">
|
| 77 |
+
Explorar <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
|
| 78 |
+
</a>
|
| 79 |
+
</div>
|
| 80 |
+
<div class="bg-white rounded-2xl shadow-xl p-8 transform hover:-translate-y-2 transition duration-300 border-t-4 border-commercial">
|
| 81 |
+
<div class="bg-commercial/10 w-16 h-16 rounded-full flex items-center justify-center mb-6">
|
| 82 |
+
<i data-feather="briefcase" class="text-commercial w-8 h-8"></i>
|
| 83 |
+
</div>
|
| 84 |
+
<h3 class="text-2xl font-bold mb-4 text-commercial">Comercial</h3>
|
| 85 |
+
<p class="text-gray-600 mb-6">Inspecciones, filmación profesional y entregas. Alta durabilidad.</p>
|
| 86 |
+
<a href="/comercial.html" class="text-commercial font-semibold inline-flex items-center">
|
| 87 |
+
Explorar <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
|
| 88 |
+
</a>
|
| 89 |
+
</div>
|
| 90 |
+
<div class="bg-white rounded-2xl shadow-xl p-8 transform hover:-translate-y-2 transition duration-300 border-t-4 border-agricultural">
|
| 91 |
+
<div class="bg-agricultural/10 w-16 h-16 rounded-full flex items-center justify-center mb-6">
|
| 92 |
+
<i data-feather="sun" class="text-agricultural w-8 h-8"></i>
|
| 93 |
+
</div>
|
| 94 |
+
<h3 class="text-2xl font-bold mb-4 text-agricultural">Agrícola</h3>
|
| 95 |
+
<p class="text-gray-600 mb-6">Fumigación, monitoreo de cultivos y análisis multispectral.</p>
|
| 96 |
+
<a href="/agricola.html" class="text-agricultural font-semibold inline-flex items-center">
|
| 97 |
+
Explorar <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
|
| 98 |
+
</a>
|
| 99 |
+
</div>
|
| 100 |
+
<div class="bg-white rounded-2xl shadow-xl p-8 transform hover:-translate-y-2 transition duration-300 border-t-4 border-military">
|
| 101 |
+
<div class="bg-military/10 w-16 h-16 rounded-full flex items-center justify-center mb-6">
|
| 102 |
+
<i data-feather="shield" class="text-military w-8 h-8"></i>
|
| 103 |
+
</div>
|
| 104 |
+
<h3 class="text-2xl font-bold mb-4 text-military">Militar & Defensa</h3>
|
| 105 |
+
<p class="text-gray-600 mb-6">Vigilancia, reconocimiento y operaciones tácticas. Máxima seguridad.</p>
|
| 106 |
+
<a href="/militar.html" class="text-military font-semibold inline-flex items-center">
|
| 107 |
+
Explorar <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
|
| 108 |
+
</a>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
</section>
|
| 113 |
+
|
| 114 |
+
<!-- Customizer Section -->
|
| 115 |
+
<section id="personalizar" class="py-20 bg-gradient-to-r from-drone/5 to-primary/5">
|
| 116 |
+
<div class="container mx-auto px-4">
|
| 117 |
+
<div class="text-center mb-16">
|
| 118 |
+
<h2 class="text-4xl font-bold mb-6">Personalización Total</h2>
|
| 119 |
+
<p class="text-xl text-gray-600 max-w-3xl mx-auto">Selecciona cada componente, desde el frame hasta el controlador de vuelo. Tu drone, tus reglas.</p>
|
| 120 |
+
</div>
|
| 121 |
+
<drone-customizer></drone-customizer>
|
| 122 |
+
</div>
|
| 123 |
+
</section>
|
| 124 |
+
|
| 125 |
+
<!-- Featured Products -->
|
| 126 |
+
<section class="py-20 bg-white">
|
| 127 |
+
<div class="container mx-auto px-4">
|
| 128 |
+
<h2 class="text-4xl font-bold text-center mb-16">Modelos Destacados</h2>
|
| 129 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
|
| 130 |
+
<!-- Product 1 -->
|
| 131 |
+
<div class="group relative bg-gray-50 rounded-2xl overflow-hidden shadow-lg hover:shadow-2xl transition duration-300">
|
| 132 |
+
<div class="h-64 overflow-hidden">
|
| 133 |
+
<img src="http://static.photos/technology/640x360/201" alt="Drone Civil" class="w-full h-full object-cover group-hover:scale-110 transition duration-500">
|
| 134 |
+
</div>
|
| 135 |
+
<div class="p-8">
|
| 136 |
+
<span class="inline-block px-4 py-1 bg-civilian/20 text-civilian rounded-full text-sm font-semibold mb-4">Civil</span>
|
| 137 |
+
<h3 class="text-2xl font-bold mb-3">Spectre X1</h3>
|
| 138 |
+
<p class="text-gray-600 mb-6">Ligero, ágil y con cámara 4K. Ideal para principiantes.</p>
|
| 139 |
+
<div class="flex justify-between items-center">
|
| 140 |
+
<span class="text-3xl font-bold text-drone">$1,299</span>
|
| 141 |
+
<button class="add-to-cart bg-primary hover:bg-blue-700 text-white px-6 py-3 rounded-lg font-semibold transition duration-300" data-id="1" data-name="Spectre X1" data-price="1299">
|
| 142 |
+
Agregar al Carro
|
| 143 |
+
</button>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
<!-- Product 2 -->
|
| 148 |
+
<div class="group relative bg-gray-50 rounded-2xl overflow-hidden shadow-lg hover:shadow-2xl transition duration-300">
|
| 149 |
+
<div class="h-64 overflow-hidden">
|
| 150 |
+
<img src="http://static.photos/agriculture/640x360/301" alt="Drone Agrícola" class="w-full h-full object-cover group-hover:scale-110 transition duration-500">
|
| 151 |
+
</div>
|
| 152 |
+
<div class="p-8">
|
| 153 |
+
<span class="inline-block px-4 py-1 bg-agricultural/20 text-agricultural rounded-full text-sm font-semibold mb-4">Agrícola</span>
|
| 154 |
+
<h3 class="text-2xl font-bold mb-3">Harvester Pro</h3>
|
| 155 |
+
<p class="text-gray-600 mb-6">Tanque de 10L, autonomía de 40min. Perfecto para cultivos.</p>
|
| 156 |
+
<div class="flex justify-between items-center">
|
| 157 |
+
<span class="text-3xl font-bold text-drone">$4,799</span>
|
| 158 |
+
<button class="add-to-cart bg-primary hover:bg-blue-700 text-white px-6 py-3 rounded-lg font-semibold transition duration-300" data-id="2" data-name="Harvester Pro" data-price="4799">
|
| 159 |
+
Agregar al Carro
|
| 160 |
+
</button>
|
| 161 |
+
</div>
|
| 162 |
+
</div>
|
| 163 |
+
</div>
|
| 164 |
+
<!-- Product 3 -->
|
| 165 |
+
<div class="group relative bg-gray-50 rounded-2xl overflow-hidden shadow-lg hover:shadow-2xl transition duration-300">
|
| 166 |
+
<div class="h-64 overflow-hidden">
|
| 167 |
+
<img src="http://static.photos/industry/640x360/401" alt="Drone Militar" class="w-full h-full object-cover group-hover:scale-110 transition duration-500">
|
| 168 |
+
</div>
|
| 169 |
+
<div class="p-8">
|
| 170 |
+
<span class="inline-block px-4 py-1 bg-military/20 text-military rounded-full text-sm font-semibold mb-4">Militar</span>
|
| 171 |
+
<h3 class="text-2xl font-bold mb-3">Stealth Recon</h3>
|
| 172 |
+
<p class="text-gray-600 mb-6">Sigilo, visión térmica y comunicación encriptada. Clase militar.</p>
|
| 173 |
+
<div class="flex justify-between items-center">
|
| 174 |
+
<span class="text-3xl font-bold text-drone">$12,999</span>
|
| 175 |
+
<button class="add-to-cart bg-primary hover:bg-blue-700 text-white px-6 py-3 rounded-lg font-semibold transition duration-300" data-id="3" data-name="Stealth Recon" data-price="12999">
|
| 176 |
+
Agregar al Carro
|
| 177 |
+
</button>
|
| 178 |
+
</div>
|
| 179 |
+
</div>
|
| 180 |
+
</div>
|
| 181 |
+
</div>
|
| 182 |
+
</div>
|
| 183 |
+
</section>
|
| 184 |
+
|
| 185 |
+
<!-- Shopping Cart Sidebar -->
|
| 186 |
+
<drone-cart></drone-cart>
|
| 187 |
+
|
| 188 |
+
<!-- Footer -->
|
| 189 |
+
<drone-footer></drone-footer>
|
| 190 |
+
|
| 191 |
+
<!-- Include Components -->
|
| 192 |
+
<script src="components/navbar.js"></script>
|
| 193 |
+
<script src="components/footer.js"></script>
|
| 194 |
+
<script src="components/customizer.js"></script>
|
| 195 |
+
<script src="components/cart.js"></script>
|
| 196 |
+
|
| 197 |
+
<!-- Main Script -->
|
| 198 |
+
<script src="script.js"></script>
|
| 199 |
+
<script>
|
| 200 |
+
feather.replace();
|
| 201 |
+
</script>
|
| 202 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 203 |
+
</body>
|
| 204 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Main JavaScript for DronesLibres.ai
|
| 2 |
+
|
| 3 |
+
// Shopping Cart Logic
|
| 4 |
+
class ShoppingCart {
|
| 5 |
+
constructor() {
|
| 6 |
+
this.items = JSON.parse(localStorage.getItem('droneCart')) || [];
|
| 7 |
+
this.updateCartUI();
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
addItem(id, name, price, quantity = 1) {
|
| 11 |
+
const existingItem = this.items.find(item => item.id === id);
|
| 12 |
+
if (existingItem) {
|
| 13 |
+
existingItem.quantity += quantity;
|
| 14 |
+
} else {
|
| 15 |
+
this.items.push({ id, name, price, quantity });
|
| 16 |
+
}
|
| 17 |
+
this.save();
|
| 18 |
+
this.updateCartUI();
|
| 19 |
+
this.showNotification(`✓ ${name} agregado al carro`);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
removeItem(id) {
|
| 23 |
+
this.items = this.items.filter(item => item.id !== id);
|
| 24 |
+
this.save();
|
| 25 |
+
this.updateCartUI();
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
updateQuantity(id, quantity) {
|
| 29 |
+
const item = this.items.find(item => item.id === id);
|
| 30 |
+
if (item) {
|
| 31 |
+
item.quantity = quantity;
|
| 32 |
+
if (item.quantity <= 0) {
|
| 33 |
+
this.removeItem(id);
|
| 34 |
+
} else {
|
| 35 |
+
this.save();
|
| 36 |
+
this.updateCartUI();
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
getTotal() {
|
| 42 |
+
return this.items.reduce((total, item) => total + (item.price * item.quantity), 0);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
getItemCount() {
|
| 46 |
+
return this.items.reduce((count, item) => count + item.quantity, 0);
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
save() {
|
| 50 |
+
localStorage.setItem('droneCart', JSON.stringify(this.items));
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
updateCartUI() {
|
| 54 |
+
const cartCount = document.getElementById('cart-count');
|
| 55 |
+
const cartTotal = document.getElementById('cart-total');
|
| 56 |
+
const cartItems = document.getElementById('cart-items');
|
| 57 |
+
|
| 58 |
+
if (cartCount) cartCount.textContent = this.getItemCount();
|
| 59 |
+
if (cartTotal) cartTotal.textContent = `$${this.getTotal().toLocaleString('es-ES')}`;
|
| 60 |
+
|
| 61 |
+
// Update cart items in sidebar if exists
|
| 62 |
+
if (cartItems && document.querySelector('drone-cart')) {
|
| 63 |
+
cartItems.innerHTML = this.items.map(item => `
|
| 64 |
+
<div class="flex items-center justify-between p-4 border-b">
|
| 65 |
+
<div>
|
| 66 |
+
<h4 class="font-semibold">${item.name}</h4>
|
| 67 |
+
<p class="text-gray-600">$${item.price.toLocaleString('es-ES')} x ${item.quantity}</p>
|
| 68 |
+
</div>
|
| 69 |
+
<div class="flex items-center gap-2">
|
| 70 |
+
<button class="decrease-item px-2 py-1 bg-gray-200 rounded" data-id="${item.id}">-</button>
|
| 71 |
+
<span>${item.quantity}</span>
|
| 72 |
+
<button class="increase-item px-2 py-1 bg-gray-200 rounded" data-id="${item.id}">+</button>
|
| 73 |
+
<button class="remove-item ml-4 text-red-500" data-id="${item.id}">
|
| 74 |
+
<i data-feather="trash-2" class="w-4 h-4"></i>
|
| 75 |
+
</button>
|
| 76 |
+
</div>
|
| 77 |
+
</div>
|
| 78 |
+
`).join('');
|
| 79 |
+
feather.replace({ 'data-feather': 'trash-2' });
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
showNotification(message) {
|
| 84 |
+
// Create notification element
|
| 85 |
+
const notification = document.createElement('div');
|
| 86 |
+
notification.className = 'fixed top-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg z-50 transform translate-x-0 transition-transform duration-300';
|
| 87 |
+
notification.textContent = message;
|
| 88 |
+
document.body.appendChild(notification);
|
| 89 |
+
|
| 90 |
+
// Remove after 3 seconds
|
| 91 |
+
setTimeout(() => {
|
| 92 |
+
notification.style.transform = 'translateX(100%)';
|
| 93 |
+
setTimeout(() => notification.remove(), 300);
|
| 94 |
+
}, 3000);
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
// Initialize cart
|
| 99 |
+
const cart = new ShoppingCart();
|
| 100 |
+
|
| 101 |
+
// DOM Content Loaded
|
| 102 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 103 |
+
// Add to cart buttons
|
| 104 |
+
document.addEventListener('click', function(e) {
|
| 105 |
+
if (e.target.classList.contains('add-to-cart')) {
|
| 106 |
+
const button = e.target;
|
| 107 |
+
const id = button.dataset.id;
|
| 108 |
+
const name = button.dataset.name;
|
| 109 |
+
const price = parseInt(button.dataset.price);
|
| 110 |
+
|
| 111 |
+
cart.addItem(id, name, price, 1);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
// Cart sidebar interactions
|
| 115 |
+
if (e.target.classList.contains('decrease-item') || e.target.closest('.decrease-item')) {
|
| 116 |
+
const button = e.target.classList.contains('decrease-item') ? e.target : e.target.closest('.decrease-item');
|
| 117 |
+
const id = button.dataset.id;
|
| 118 |
+
const item = cart.items.find(item => item.id === id);
|
| 119 |
+
if (item) cart.updateQuantity(id, item.quantity - 1);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
if (e.target.classList.contains('increase-item') || e.target.closest('.increase-item')) {
|
| 123 |
+
const button = e.target.classList.contains('increase-item') ? e.target : e.target.closest('.increase-item');
|
| 124 |
+
const id = button.dataset.id;
|
| 125 |
+
const item = cart.items.find(item => item.id === id);
|
| 126 |
+
if (item) cart.updateQuantity(id, item.quantity + 1);
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
if (e.target.classList.contains('remove-item') || e.target.closest('.remove-item')) {
|
| 130 |
+
const button = e.target.classList.contains('remove-item') ? e.target : e.target.closest('.remove-item');
|
| 131 |
+
const id = button.dataset.id;
|
| 132 |
+
cart.removeItem(id);
|
| 133 |
+
}
|
| 134 |
+
});
|
| 135 |
+
|
| 136 |
+
// Toggle cart sidebar
|
| 137 |
+
document.addEventListener('click', function(e) {
|
| 138 |
+
if (e.target.closest('#cart-toggle')) {
|
| 139 |
+
const cartSidebar = document.querySelector('drone-cart');
|
| 140 |
+
if (cartSidebar) {
|
| 141 |
+
const isHidden = cartSidebar.style.right === '-400px' || !cartSidebar.style.right;
|
| 142 |
+
cartSidebar.style.right = isHidden ? '0' : '-400px';
|
| 143 |
+
|
| 144 |
+
// Update overlay
|
| 145 |
+
const overlay = document.getElementById('cart-overlay');
|
| 146 |
+
if (overlay) {
|
| 147 |
+
overlay.classList.toggle('hidden', !isHidden);
|
| 148 |
+
overlay.classList.toggle('opacity-0', !isHidden);
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
});
|
| 153 |
+
|
| 154 |
+
// Close cart when clicking overlay
|
| 155 |
+
document.addEventListener('click', function(e) {
|
| 156 |
+
if (e.target.id === 'cart-overlay') {
|
| 157 |
+
const cartSidebar = document.querySelector('drone-cart');
|
| 158 |
+
const overlay = document.getElementById('cart-overlay');
|
| 159 |
+
if (cartSidebar) cartSidebar.style.right = '-400px';
|
| 160 |
+
if (overlay) {
|
| 161 |
+
overlay.classList.add('hidden', 'opacity-0');
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
});
|
| 165 |
+
|
| 166 |
+
// Initialize Feather Icons
|
| 167 |
+
if (typeof feather !== 'undefined') {
|
| 168 |
+
feather.replace();
|
| 169 |
+
}
|
| 170 |
+
});
|
| 171 |
+
|
| 172 |
+
// API Integration for drone parts (example)
|
| 173 |
+
async function fetchDroneParts(category) {
|
| 174 |
+
try {
|
| 175 |
+
// This would be replaced with actual API endpoint
|
| 176 |
+
const response = await fetch(`https://api.example.com/drone-parts?category=${category}`);
|
| 177 |
+
const data = await response.json();
|
| 178 |
+
return data;
|
| 179 |
+
} catch (error) {
|
| 180 |
+
console.error('Error fetching drone parts:', error);
|
| 181 |
+
return [];
|
| 182 |
+
}
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
// Form validation for customizer
|
| 186 |
+
function validateCustomizerForm() {
|
| 187 |
+
const frames = document.querySelectorAll('input[name="frame"]:checked');
|
| 188 |
+
const motors = document.querySelectorAll('input[name="motor"]:checked');
|
| 189 |
+
|
| 190 |
+
if (frames.length === 0) {
|
| 191 |
+
alert('Por favor selecciona un frame.');
|
| 192 |
+
return false;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
if (motors.length === 0) {
|
| 196 |
+
alert('Por favor selecciona motores.');
|
| 197 |
+
return false;
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
return true;
|
| 201 |
+
}
|
style.css
CHANGED
|
@@ -1,28 +1,60 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
margin-top: 0;
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Custom Styles for DronesLibres.ai */
|
| 2 |
+
|
| 3 |
+
/* Smooth scrolling */
|
| 4 |
+
html {
|
| 5 |
+
scroll-behavior: smooth;
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
/* Custom animations */
|
| 9 |
+
@keyframes float {
|
| 10 |
+
0%, 100% { transform: translateY(0); }
|
| 11 |
+
50% { transform: translateY(-10px); }
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
.float-animation {
|
| 15 |
+
animation: float 3s ease-in-out infinite;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
/* Gradient backgrounds */
|
| 19 |
+
.gradient-primary {
|
| 20 |
+
background: linear-gradient(135deg, #3b82f6 0%, #0ea5e9 100%);
|
| 21 |
}
|
| 22 |
|
| 23 |
+
.gradient-secondary {
|
| 24 |
+
background: linear-gradient(135deg, #10b981 0%, #22c55e 100%);
|
|
|
|
| 25 |
}
|
| 26 |
|
| 27 |
+
/* Custom shadows */
|
| 28 |
+
.shadow-drone {
|
| 29 |
+
box-shadow: 0 10px 30px rgba(14, 165, 233, 0.2);
|
|
|
|
|
|
|
| 30 |
}
|
| 31 |
|
| 32 |
+
/* Component transition */
|
| 33 |
+
.customizer-transition {
|
| 34 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
|
|
|
|
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
+
/* Responsive tweaks */
|
| 38 |
+
@media (max-width: 768px) {
|
| 39 |
+
.hero-text {
|
| 40 |
+
font-size: 2.5rem;
|
| 41 |
+
}
|
| 42 |
}
|
| 43 |
+
|
| 44 |
+
/* Custom scrollbar */
|
| 45 |
+
::-webkit-scrollbar {
|
| 46 |
+
width: 10px;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
::-webkit-scrollbar-track {
|
| 50 |
+
background: #f1f1f1;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
::-webkit-scrollbar-thumb {
|
| 54 |
+
background: #3b82f6;
|
| 55 |
+
border-radius: 5px;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
::-webkit-scrollbar-thumb:hover {
|
| 59 |
+
background: #2563eb;
|
| 60 |
+
}
|