kloudboy commited on
Commit
367f74f
·
verified ·
1 Parent(s): 7a747c2

modern woocomrce flutter app

Browse files
Files changed (2) hide show
  1. README.md +8 -5
  2. index.html +553 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Shopsphere
3
- emoji: 📈
4
- colorFrom: yellow
5
- colorTo: pink
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: ShopSphere 🛍️
3
+ colorFrom: pink
4
+ colorTo: purple
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://deepsite.hf.co).
index.html CHANGED
@@ -1,19 +1,554 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>ShopSphere - Modern WooCommerce Experience</title>
7
+ <link rel="icon" type="image/x-icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🛍️</text></svg>">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/animejs/lib/anime.iife.min.js"></script>
11
+ <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.net.min.js"></script>
12
+ <script src="https://unpkg.com/feather-icons"></script>
13
+ <style>
14
+ :root {
15
+ --primary: #6366f1;
16
+ --primary-dark: #4f46e5;
17
+ --secondary: #ec4899;
18
+ --secondary-dark: #db2777;
19
+ --accent: #f59e0b;
20
+ --surface: #ffffff;
21
+ --surface-dark: #0f172a;
22
+ --text: #1e293b;
23
+ --text-dark: #f1f5f9;
24
+ --border: #e2e8f0;
25
+ --border-dark: #334155;
26
+ }
27
+
28
+ .dark {
29
+ --surface: #0f172a;
30
+ --text: #f1f5f9;
31
+ --border: #334155;
32
+ }
33
+
34
+ .glass-effect {
35
+ backdrop-filter: blur(10px);
36
+ background: rgba(255, 255, 255, 0.1);
37
+ border: 1px solid rgba(255, 255, 255, 0.2);
38
+ }
39
+
40
+ .dark .glass-effect {
41
+ background: rgba(15, 23, 42, 0.3);
42
+ border: 1px solid rgba(255, 255, 255, 0.1);
43
+ }
44
+
45
+ .gradient-text {
46
+ background: linear-gradient(135deg, var(--primary), var(--secondary));
47
+ -webkit-background-clip: text;
48
+ -webkit-text-fill-color: transparent;
49
+ background-clip: text;
50
+ }
51
+
52
+ .product-card {
53
+ transition: all 0.3s ease;
54
+ transform: translateY(0);
55
+ }
56
+
57
+ .product-card:hover {
58
+ transform: translateY(-8px);
59
+ box-shadow: 0 20px 40px rgba(99, 102, 241, 0.15);
60
+ }
61
+
62
+ .dark .product-card:hover {
63
+ box-shadow: 0 20px 40px rgba(99, 102, 241, 0.3);
64
+ }
65
+
66
+ .cart-drawer {
67
+ transform: translateX(100%);
68
+ transition: transform 0.3s ease;
69
+ }
70
+
71
+ .cart-drawer.open {
72
+ transform: translateX(0);
73
+ }
74
+
75
+ .pulse-animation {
76
+ animation: pulse 2s infinite;
77
+ }
78
+
79
+ @keyframes pulse {
80
+ 0%, 100% { opacity: 1; }
81
+ 50% { opacity: 0.5; }
82
+ }
83
+
84
+ .floating-action {
85
+ position: fixed;
86
+ bottom: 2rem;
87
+ right: 2rem;
88
+ z-index: 50;
89
+ }
90
+
91
+ .search-overlay {
92
+ opacity: 0;
93
+ visibility: hidden;
94
+ transition: all 0.3s ease;
95
+ }
96
+
97
+ .search-overlay.active {
98
+ opacity: 1;
99
+ visibility: visible;
100
+ }
101
+
102
+ .category-pill {
103
+ transition: all 0.2s ease;
104
+ }
105
+
106
+ .category-pill.active {
107
+ background: var(--primary);
108
+ color: white;
109
+ }
110
+
111
+ .loading-skeleton {
112
+ background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
113
+ background-size: 200% 100%;
114
+ animation: loading 1.5s infinite;
115
+ }
116
+
117
+ @keyframes loading {
118
+ 0% { background-position: 200% 0; }
119
+ 100% { background-position: -200% 0; }
120
+ }
121
+ </style>
122
+ </head>
123
+ <body class="bg-slate-50 dark:bg-slate-900 text-slate-900 dark:text-slate-100 transition-colors duration-300">
124
+ <!-- Header -->
125
+ <header class="sticky top-0 z-40 bg-white/80 dark:bg-slate-900/80 glass-effect">
126
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
127
+ <div class="flex items-center justify-between h-16">
128
+ <!-- Logo -->
129
+ <div class="flex items-center space-x-2">
130
+ <div class="w-8 h-8 bg-gradient-to-br from-indigo-500 to-pink-500 rounded-lg flex items-center justify-center">
131
+ <i data-feather="shopping-bag" class="w-5 h-5 text-white"></i>
132
+ </div>
133
+ <span class="text-xl font-bold gradient-text">ShopSphere</span>
134
+ </div>
135
+
136
+ <!-- Search Bar -->
137
+ <div class="hidden md:flex flex-1 max-w-md mx-8">
138
+ <div class="relative w-full">
139
+ <input type="text"
140
+ placeholder="Search products..."
141
+ class="w-full pl-10 pr-4 py-2 bg-slate-100 dark:bg-slate-800 rounded-full focus:outline-none focus:ring-2 focus:ring-indigo-500"
142
+ id="searchInput">
143
+ <i data-feather="search" class="absolute left-3 top-2.5 w-5 h-5 text-slate-400"></i>
144
+ </div>
145
+ </div>
146
+
147
+ <!-- Actions -->
148
+ <div class="flex items-center space-x-4">
149
+ <button class="p-2 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-full transition-colors" id="themeToggle">
150
+ <i data-feather="moon" class="w-5 h-5 dark:hidden"></i>
151
+ <i data-feather="sun" class="w-5 h-5 hidden dark:block"></i>
152
+ </button>
153
+ <button class="p-2 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-full transition-colors relative" id="cartBtn">
154
+ <i data-feather="shopping-cart" class="w-5 h-5"></i>
155
+ <span class="absolute -top-1 -right-1 bg-pink-500 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center" id="cartCount">0</span>
156
+ </button>
157
+ <button class="md:hidden p-2 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-full transition-colors" id="searchBtn">
158
+ <i data-feather="search" class="w-5 h-5"></i>
159
+ </button>
160
+ </div>
161
+ </div>
162
+ </div>
163
+ </header>
164
+
165
+ <!-- Hero Section -->
166
+ <section class="relative h-[60vh] overflow-hidden">
167
+ <div id="vanta-bg" class="absolute inset-0"></div>
168
+ <div class="relative z-10 h-full flex items-center justify-center text-center px-4">
169
+ <div>
170
+ <h1 class="text-4xl md:text-6xl font-bold mb-4">
171
+ Discover Your <span class="gradient-text">Style</span>
172
+ </h1>
173
+ <p class="text-lg md:text-xl text-slate-600 dark:text-slate-300 mb-8 max-w-2xl mx-auto">
174
+ Explore thousands of products with our modern shopping experience
175
+ </p>
176
+ <button class="bg-indigo-600 hover:bg-indigo-700 text-white px-8 py-3 rounded-full font-medium transition-colors">
177
+ Start Shopping
178
+ </button>
179
+ </div>
180
+ </div>
181
+ </section>
182
+
183
+ <!-- Categories -->
184
+ <section class="py-12 px-4">
185
+ <div class="max-w-7xl mx-auto">
186
+ <h2 class="text-2xl font-bold mb-6">Shop by Category</h2>
187
+ <div class="flex space-x-4 overflow-x-auto pb-4" id="categories">
188
+ <button class="category-pill active px-6 py-2 rounded-full bg-indigo-100 dark:bg-indigo-900/30 text-indigo-700 dark:text-indigo-300 whitespace-nowrap" data-category="all">
189
+ All Products
190
+ </button>
191
+ <button class="category-pill px-6 py-2 rounded-full bg-slate-100 dark:bg-slate-800 hover:bg-indigo-100 dark:hover:bg-indigo-900/30 transition-colors" data-category="electronics">
192
+ Electronics
193
+ </button>
194
+ <button class="category-pill px-6 py-2 rounded-full bg-slate-100 dark:bg-slate-800 hover:bg-indigo-100 dark:hover:bg-indigo-900/30 transition-colors" data-category="fashion">
195
+ Fashion
196
+ </button>
197
+ <button class="category-pill px-6 py-2 rounded-full bg-slate-100 dark:bg-slate-800 hover:bg-indigo-100 dark:hover:bg-indigo-900/30 transition-colors" data-category="home">
198
+ Home & Living
199
+ </button>
200
+ <button class="category-pill px-6 py-2 rounded-full bg-slate-100 dark:bg-slate-800 hover:bg-indigo-100 dark:hover:bg-indigo-900/30 transition-colors" data-category="beauty">
201
+ Beauty
202
+ </button>
203
+ </div>
204
+ </div>
205
+ </section>
206
+
207
+ <!-- Products Grid -->
208
+ <section class="py-12 px-4">
209
+ <div class="max-w-7xl mx-auto">
210
+ <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6" id="productsGrid">
211
+ <!-- Products will be loaded here -->
212
+ </div>
213
+ </div>
214
+ </section>
215
+
216
+ <!-- Cart Drawer -->
217
+ <div class="cart-drawer fixed top-0 right-0 h-full w-full sm:w-96 bg-white dark:bg-slate-900 shadow-2xl z-50" id="cartDrawer">
218
+ <div class="p-4 border-b border-slate-200 dark:border-slate-700">
219
+ <div class="flex items-center justify-between">
220
+ <h3 class="text-lg font-semibold">Shopping Cart</h3>
221
+ <button class="p-2 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-full" id="closeCart">
222
+ <i data-feather="x" class="w-5 h-5"></i>
223
+ </button>
224
+ </div>
225
+ </div>
226
+ <div class="flex-1 overflow-y-auto p-4" id="cartItems">
227
+ <p class="text-center text-slate-500 dark:text-slate-400 py-8">Your cart is empty</p>
228
+ </div>
229
+ <div class="p-4 border-t border-slate-200 dark:border-slate-700">
230
+ <div class="flex justify-between mb-4">
231
+ <span class="font-semibold">Total:</span>
232
+ <span class="font-bold text-lg" id="cartTotal">$0.00</span>
233
+ </div>
234
+ <button class="w-full bg-indigo-600 hover:bg-indigo-700 text-white py-3 rounded-lg font-medium transition-colors">
235
+ Checkout
236
+ </button>
237
+ </div>
238
+ </div>
239
+
240
+ <!-- Search Overlay -->
241
+ <div class="search-overlay fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4" id="searchOverlay">
242
+ <div class="bg-white dark:bg-slate-900 rounded-2xl p-6 w-full max-w-2xl">
243
+ <div class="flex items-center space-x-4 mb-4">
244
+ <i data-feather="search" class="w-5 h-5 text-slate-400"></i>
245
+ <input type="text"
246
+ placeholder="Search for products..."
247
+ class="flex-1 bg-transparent text-lg focus:outline-none"
248
+ id="overlaySearchInput">
249
+ <button class="p-2 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-full" id="closeSearch">
250
+ <i data-feather="x" class="w-5 h-5"></i>
251
+ </button>
252
+ </div>
253
+ <div id="searchResults" class="space-y-2">
254
+ <!-- Search results will appear here -->
255
+ </div>
256
+ </div>
257
+ </div>
258
+
259
+ <!-- Floating Action Button -->
260
+ <button class="floating-action bg-indigo-600 hover:bg-indigo-700 text-white p-4 rounded-full shadow-lg transition-transform hover:scale-110" id="fab">
261
+ <i data-feather="arrow-up" class="w-6 h-6"></i>
262
+ </button>
263
+
264
+ <script>
265
+ // Initialize Vanta.js background
266
+ VANTA.NET({
267
+ el: "#vanta-bg",
268
+ mouseControls: true,
269
+ touchControls: true,
270
+ gyroControls: false,
271
+ minHeight: 200.00,
272
+ minWidth: 200.00,
273
+ scale: 1.00,
274
+ scaleMobile: 1.00,
275
+ color: 0x6366f1,
276
+ backgroundColor: 0xffffff,
277
+ points: 8.00,
278
+ maxDistance: 25.00,
279
+ spacing: 20.00
280
+ });
281
+
282
+ // Theme toggle
283
+ const themeToggle = document.getElementById('themeToggle');
284
+ const html = document.documentElement;
285
+
286
+ themeToggle.addEventListener('click', () => {
287
+ html.classList.toggle('dark');
288
+ localStorage.setItem('theme', html.classList.contains('dark') ? 'dark' : 'light');
289
+ });
290
+
291
+ // Load saved theme
292
+ if (localStorage.getItem('theme') === 'dark') {
293
+ html.classList.add('dark');
294
+ }
295
+
296
+ // Sample products data
297
+ const products = [
298
+ {
299
+ id: 1,
300
+ name: "Wireless Headphones",
301
+ price: 199.99,
302
+ category: "electronics",
303
+ image: "http://static.photos/technology/320x240/1",
304
+ rating: 4.5,
305
+ reviews: 234
306
+ },
307
+ {
308
+ id: 2,
309
+ name: "Designer T-Shirt",
310
+ price: 49.99,
311
+ category: "fashion",
312
+ image: "http://static.photos/fashion/320x240/2",
313
+ rating: 4.8,
314
+ reviews: 156
315
+ },
316
+ {
317
+ id: 3,
318
+ name: "Smart Home Hub",
319
+ price: 129.99,
320
+ category: "home",
321
+ image: "http://static.photos/technology/320x240/3",
322
+ rating: 4.3,
323
+ reviews: 89
324
+ },
325
+ {
326
+ id: 4,
327
+ name: "Organic Face Cream",
328
+ price: 34.99,
329
+ category: "beauty",
330
+ image: "http://static.photos/wellness/320x240/4",
331
+ rating: 4.7,
332
+ reviews: 312
333
+ },
334
+ {
335
+ id: 5,
336
+ name: "Laptop Stand",
337
+ price: 79.99,
338
+ category: "electronics",
339
+ image: "http://static.photos/workspace/320x240/5",
340
+ rating: 4.6,
341
+ reviews: 178
342
+ },
343
+ {
344
+ id: 6,
345
+ name: "Summer Dress",
346
+ price: 89.99,
347
+ category: "fashion",
348
+ image: "http://static.photos/fashion/320x240/6",
349
+ rating: 4.9,
350
+ reviews: 423
351
+ },
352
+ {
353
+ id: 7,
354
+ name: "Aromatherapy Diffuser",
355
+ price: 59.99,
356
+ category: "home",
357
+ image: "http://static.photos/wellness/320x240/7",
358
+ rating: 4.4,
359
+ reviews: 267
360
+ },
361
+ {
362
+ id: 8,
363
+ name: "Vitamin C Serum",
364
+ price: 24.99,
365
+ category: "beauty",
366
+ image: "http://static.photos/wellness/320x240/8",
367
+ rating: 4.6,
368
+ reviews: 198
369
+ }
370
+ ];
371
+
372
+ // Cart functionality
373
+ let cart = [];
374
+
375
+ function addToCart(product) {
376
+ const existingItem = cart.find(item => item.id === product.id);
377
+ if (existingItem) {
378
+ existingItem.quantity += 1;
379
+ } else {
380
+ cart.push({ ...product, quantity: 1 });
381
+ }
382
+ updateCart();
383
+ showCartNotification();
384
+ }
385
+
386
+ function updateCart() {
387
+ const cartCount = document.getElementById('cartCount');
388
+ const cartItems = document.getElementById('cartItems');
389
+ const cartTotal = document.getElementById('cartTotal');
390
+
391
+ cartCount.textContent = cart.reduce((sum, item) => sum + item.quantity, 0);
392
+
393
+ if (cart.length === 0) {
394
+ cartItems.innerHTML = '<p class="text-center text-slate-500 dark:text-slate-400 py-8">Your cart is empty</p>';
395
+ } else {
396
+ cartItems.innerHTML = cart.map(item => `
397
+ <div class="flex items-center space-x-4 p-4 bg-slate-50 dark:bg-slate-800 rounded-lg mb-2">
398
+ <img src="${item.image}" alt="${item.name}" class="w-16 h-16 rounded-lg object-cover">
399
+ <div class="flex-1">
400
+ <h4 class="font-medium">${item.name}</h4>
401
+ <p class="text-sm text-slate-500 dark:text-slate-400">$${item.price}</p>
402
+ </div>
403
+ <div class="flex items-center space-x-2">
404
+ <button class="p-1 hover:bg-slate-200 dark:hover:bg-slate-700 rounded" onclick="updateQuantity(${item.id}, -1)">
405
+ <i data-feather="minus" class="w-4 h-4"></i>
406
+ </button>
407
+ <span class="w-8 text-center">${item.quantity}</span>
408
+ <button class="p-1 hover:bg-slate-200 dark:hover:bg-slate-700 rounded" onclick="updateQuantity(${item.id}, 1)">
409
+ <i data-feather="plus" class="w-4 h-4"></i>
410
+ </button>
411
+ </div>
412
+ </div>
413
+ `).join('');
414
+ }
415
+
416
+ const total = cart.reduce((sum, item) => sum + (item.price * item.quantity), 0);
417
+ cartTotal.textContent = `$${total.toFixed(2)}`;
418
+ }
419
+
420
+ function updateQuantity(productId, change) {
421
+ const item = cart.find(item => item.id === productId);
422
+ if (item) {
423
+ item.quantity += change;
424
+ if (item.quantity <= 0) {
425
+ cart = cart.filter(item => item.id !== productId);
426
+ }
427
+ updateCart();
428
+ }
429
+ }
430
+
431
+ function showCartNotification() {
432
+ const notification = document.createElement('div');
433
+ notification.className = 'fixed top-20 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg z-50';
434
+ notification.textContent = 'Added to cart!';
435
+ document.body.appendChild(notification);
436
+
437
+ setTimeout(() => {
438
+ notification.remove();
439
+ }, 2000);
440
+ }
441
+
442
+ // Render products
443
+ function renderProducts(productsToRender = products) {
444
+ const grid = document.getElementById('productsGrid');
445
+ grid.innerHTML = productsToRender.map(product => `
446
+ <div class="product-card bg-white dark:bg-slate-800 rounded-xl overflow-hidden shadow-sm">
447
+ <div class="aspect-square overflow-hidden">
448
+ <img src="${product.image}" alt="${product.name}" class="w-full h-full object-cover hover:scale-105 transition-transform duration-300">
449
+ </div>
450
+ <div class="p-4">
451
+ <h3 class="font-semibold mb-1">${product.name}</h3>
452
+ <div class="flex items-center space-x-1 mb-2">
453
+ <div class="flex">
454
+ ${Array(5).fill(0).map((_, i) =>
455
+ `<i data-feather="star" class="w-4 h-4 ${i < Math.floor(product.rating) ? 'fill-amber-400 text-amber-400' : 'text-slate-300'}"></i>`
456
+ ).join('')}
457
+ </div>
458
+ <span class="text-sm text-slate-500 dark:text-slate-400">(${product.reviews})</span>
459
+ </div>
460
+ <div class="flex items-center justify-between">
461
+ <span class="text-xl font-bold">$${product.price}</span>
462
+ <button onclick="addToCart(${JSON.stringify(product).replace(/"/g, '&quot;')})"
463
+ class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg transition-colors">
464
+ <i data-feather="shopping-cart" class="w-4 h-4"></i>
465
+ </button>
466
+ </div>
467
+ </div>
468
+ </div>
469
+ `).join('');
470
+
471
+ feather.replace();
472
+ }
473
+
474
+ // Category filtering
475
+ document.querySelectorAll('.category-pill').forEach(pill => {
476
+ pill.addEventListener('click', (e) => {
477
+ document.querySelectorAll('.category-pill').forEach(p => p.classList.remove('active'));
478
+ e.target.classList.add('active');
479
+
480
+ const category = e.target.dataset.category;
481
+ const filtered = category === 'all' ? products : products.filter(p => p.category === category);
482
+ renderProducts(filtered);
483
+ });
484
+ });
485
+
486
+ // Cart drawer
487
+ const cartBtn = document.getElementById('cartBtn');
488
+ const closeCart = document.getElementById('closeCart');
489
+ const cartDrawer = document.getElementById('cartDrawer');
490
+
491
+ cartBtn.addEventListener('click', () => {
492
+ cartDrawer.classList.add('open');
493
+ });
494
+
495
+ closeCart.addEventListener('click', () => {
496
+ cartDrawer.classList.remove('open');
497
+ });
498
+
499
+ // Search overlay
500
+ const searchBtn = document.getElementById('searchBtn');
501
+ const searchOverlay = document.getElementById('searchOverlay');
502
+ const closeSearch = document.getElementById('closeSearch');
503
+ const overlaySearchInput = document.getElementById('overlaySearchInput');
504
+ const searchResults = document.getElementById('searchResults');
505
+
506
+ searchBtn.addEventListener('click', () => {
507
+ searchOverlay.classList.add('active');
508
+ overlaySearchInput.focus();
509
+ });
510
+
511
+ closeSearch.addEventListener('click', () => {
512
+ searchOverlay.classList.remove('active');
513
+ });
514
+
515
+ overlaySearchInput.addEventListener('input', (e) => {
516
+ const query = e.target.value.toLowerCase();
517
+ const results = products.filter(p =>
518
+ p.name.toLowerCase().includes(query) ||
519
+ p.category.toLowerCase().includes(query)
520
+ );
521
+
522
+ searchResults.innerHTML = results.map(product => `
523
+ <div class="flex items-center space-x-3 p-3 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-lg cursor-pointer">
524
+ <img src="${product.image}" alt="${product.name}" class="w-12 h-12 rounded-lg object-cover">
525
+ <div>
526
+ <p class="font-medium">${product.name}</p>
527
+ <p class="text-sm text-slate-500 dark:text-slate-400">$${product.price}</p>
528
+ </div>
529
+ </div>
530
+ `).join('');
531
+ });
532
+
533
+ // Floating action button
534
+ const fab = document.getElementById('fab');
535
+ fab.addEventListener('click', () => {
536
+ window.scrollTo({ top: 0, behavior: 'smooth' });
537
+ });
538
+
539
+ // Show/hide FAB based on scroll
540
+ window.addEventListener('scroll', () => {
541
+ if (window.scrollY > 300) {
542
+ fab.style.transform = 'scale(1)';
543
+ } else {
544
+ fab.style.transform = 'scale(0)';
545
+ }
546
+ });
547
+
548
+ // Initialize
549
+ renderProducts();
550
+ updateCart();
551
+ feather.replace();
552
+ </script>
553
+ </body>
554
  </html>