dodey917 commited on
Commit
135fe83
·
verified ·
1 Parent(s): 91db371
Files changed (6) hide show
  1. components/footer.js +130 -0
  2. components/navbar.js +218 -0
  3. index.html +7 -31
  4. script.js +162 -145
  5. shop.html +98 -0
  6. style.css +99 -56
components/footer.js ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ :host {
7
+ display: block;
8
+ margin-top: auto;
9
+ }
10
+ footer {
11
+ background: #111827;
12
+ color: white;
13
+ padding: 3rem 1.5rem;
14
+ }
15
+ .container {
16
+ max-width: 1280px;
17
+ margin: 0 auto;
18
+ }
19
+ .grid {
20
+ display: grid;
21
+ gap: 2rem;
22
+ margin-bottom: 2rem;
23
+ }
24
+ @media (min-width: 768px) {
25
+ .grid {
26
+ grid-template-columns: repeat(4, 1fr);
27
+ }
28
+ }
29
+ h3, h4 {
30
+ font-weight: 600;
31
+ }
32
+ h3 {
33
+ font-size: 1.25rem;
34
+ margin-bottom: 1rem;
35
+ }
36
+ h4 {
37
+ font-size: 1rem;
38
+ margin-bottom: 1rem;
39
+ }
40
+ a {
41
+ color: #9ca3af;
42
+ text-decoration: none;
43
+ transition: color 0.3s;
44
+ }
45
+ a:hover {
46
+ color: white;
47
+ }
48
+ .social-icons {
49
+ display: flex;
50
+ gap: 1rem;
51
+ }
52
+ .social-icons a {
53
+ display: grid;
54
+ place-items: center;
55
+ width: 2.5rem;
56
+ height: 2.5rem;
57
+ background: #1f2937;
58
+ border-radius: 50%;
59
+ }
60
+ .social-icons a:hover {
61
+ background: #374151;
62
+ }
63
+ .border-t {
64
+ border-top: 1px solid #374151;
65
+ }
66
+ .text-center {
67
+ text-align: center;
68
+ }
69
+ .text-gray-400 {
70
+ color: #9ca3af;
71
+ }
72
+ .py-8 {
73
+ padding-top: 2rem;
74
+ padding-bottom: 2rem;
75
+ }
76
+ .pt-8 {
77
+ padding-top: 2rem;
78
+ }
79
+ </style>
80
+ <footer>
81
+ <div class="container">
82
+ <div class="grid">
83
+ <div>
84
+ <h3 class="text-xl font-bold mb-4">ShopSparkle</h3>
85
+ <p class="text-gray-400">Your premium destination for quality tech products.</p>
86
+ </div>
87
+ <div>
88
+ <h4 class="font-semibold mb-4">Quick Links</h4>
89
+ <ul class="space-y-2 text-gray-400">
90
+ <li><a href="/about.html">About Us</a></li>
91
+ <li><a href="/contact.html">Contact</a></li>
92
+ <li><a href="/faqs.html">FAQs</a></li>
93
+ <li><a href="/shipping.html">Shipping Info</a></li>
94
+ </ul>
95
+ </div>
96
+ <div>
97
+ <h4 class="font-semibold mb-4">Customer Service</h4>
98
+ <ul class="space-y-2 text-gray-400">
99
+ <li><a href="/returns.html">Returns</a></li>
100
+ <li><a href="/warranty.html">Warranty</a></li>
101
+ <li><a href="/size-guide.html">Size Guide</a></li>
102
+ <li><a href="/track-order.html">Track Order</a></li>
103
+ </ul>
104
+ </div>
105
+ <div>
106
+ <h4 class="font-semibold mb-4">Follow Us</h4>
107
+ <div class="social-icons">
108
+ <a href="#"><i data-feather="facebook" class="w-5 h-5"></i></a>
109
+ <a href="#"><i data-feather="twitter" class="w-5 h-5"></i></a>
110
+ <a href="#"><i data-feather="instagram" class="w-5 h-5"></i></a>
111
+ <a href="#"><i data-feather="youtube" class="w-5 h-5"></i></a>
112
+ </div>
113
+ </div>
114
+ <div class="border-t pt-8 text-center text-gray-400">
115
+ <p>&copy; 2024 ShopSparkle. All rights reserved.</p>
116
+ </div>
117
+ </div>
118
+ </footer>
119
+ `;
120
+
121
+ // Initialize feather icons
122
+ setTimeout(() => {
123
+ if (typeof feather !== 'undefined') {
124
+ feather.replace();
125
+ }
126
+ }, 100);
127
+ }
128
+ }
129
+
130
+ customElements.define('custom-footer', CustomFooter);
components/navbar.js ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomNavbar extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ :host {
7
+ display: block;
8
+ position: sticky;
9
+ top: 0;
10
+ z-index: 40;
11
+ }
12
+ header {
13
+ background: white;
14
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
15
+ width: 100%;
16
+ font-family: system-ui, -apple-system, sans-serif;
17
+ }
18
+ nav {
19
+ max-width: 1280px;
20
+ margin: 0 auto;
21
+ padding: 1rem 1.5rem;
22
+ display: flex;
23
+ align-items: center;
24
+ justify-content: space-between;
25
+ }
26
+ .logo {
27
+ font-size: 1.5rem;
28
+ font-weight: bold;
29
+ color: #4f46e5;
30
+ text-decoration: none;
31
+ display: flex;
32
+ align-items: center;
33
+ gap: 0.75rem;
34
+ }
35
+ .logo-icon {
36
+ color: #8b5cf6;
37
+ font-size: 1.8rem;
38
+ animation: float 4s ease-in-out infinite;
39
+ }
40
+ .nav-links {
41
+ display: none;
42
+ gap: 1.5rem;
43
+ }
44
+ .nav-links a {
45
+ color: #4b5563;
46
+ text-decoration: none;
47
+ font-weight: 500;
48
+ transition: color 0.3s;
49
+ }
50
+ .nav-links a:hover {
51
+ color: #4f46e5;
52
+ }
53
+ .nav-actions {
54
+ display: flex;
55
+ align-items: center;
56
+ gap: 1rem;
57
+ }
58
+ .nav-button {
59
+ background: transparent;
60
+ border: none;
61
+ padding: 0.5rem;
62
+ border-radius: 0.5rem;
63
+ transition: background 0.3s;
64
+ cursor: pointer;
65
+ position: relative;
66
+ display: grid;
67
+ place-items: center;
68
+ }
69
+ .nav-button:hover {
70
+ background: #f3f4f6;
71
+ }
72
+ .cart-badge {
73
+ position: absolute;
74
+ top: -2px;
75
+ right: -2px;
76
+ background: #4f46e5;
77
+ color: white;
78
+ font-size: 0.75rem;
79
+ border-radius: 9999px;
80
+ width: 1.25rem;
81
+ height: 1.25rem;
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ border-radius: 50%;
86
+ }
87
+ .mobile-menu-btn {
88
+ display: block;
89
+ background: transparent;
90
+ border: none;
91
+ padding: 0.5rem;
92
+ border-radius: 0.5rem;
93
+ transition: background 0.3s;
94
+ cursor: pointer;
95
+ }
96
+ .mobile-menu {
97
+ display: none;
98
+ flex-direction: column;
99
+ gap: 1rem;
100
+ padding: 1.5rem;
101
+ background: white;
102
+ border-top: 1px solid #e5e7eb;
103
+ position: absolute;
104
+ top: 100%;
105
+ left: 0;
106
+ width: 100%;
107
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
108
+ z-index: 30;
109
+ }
110
+ .mobile-menu.open {
111
+ display: flex;
112
+ }
113
+ .mobile-menu a {
114
+ color: #374151;
115
+ text-decoration: none;
116
+ padding: 0.5rem;
117
+ border-radius: 0.5rem;
118
+ transition: background 0.3s;
119
+ }
120
+ .mobile-menu a:hover {
121
+ background: #f9fafb;
122
+ }
123
+ @media (min-width: 768px) {
124
+ .nav-links {
125
+ display: flex;
126
+ }
127
+ .mobile-menu-btn {
128
+ display: none;
129
+ }
130
+ }
131
+ @keyframes float {
132
+ 0%, 100% { transform: translateY(0); }
133
+ 50% { transform: translateY(-8px); }
134
+ }
135
+ </style>
136
+ <header>
137
+ <nav>
138
+ <div style="display: flex; align-items: center; gap: 2rem;">
139
+ <a href="/" class="logo">
140
+ <i class="fas fa-gem logo-icon"></i>
141
+ ShopSparkle
142
+ </a>
143
+ <div class="nav-links">
144
+ <a href="/">Home</a>
145
+ <a href="/shop.html">Shop</a>
146
+ <a href="/new-arrivals.html">New Arrivals</a>
147
+ <a href="/sale.html">Sale</a>
148
+ <a href="/about.html">About</a>
149
+ <a href="/contact.html">Contact</a>
150
+ </div>
151
+ </div>
152
+ <div class="nav-actions">
153
+ <button class="nav-button search-btn" title="Search">
154
+ <i data-feather="search" class="w-5 h-5"></i>
155
+ </button>
156
+ <button class="nav-button cart-btn" title="Cart">
157
+ <i data-feather="shopping-cart" class="w-5 h-5"></i>
158
+ <span class="cart-badge">0</span>
159
+ </button>
160
+ <button class="nav-button user-btn" title="Account">
161
+ <i data-feather="user" class="w-5 h-5"></i>
162
+ </button>
163
+ <button class="mobile-menu-btn" id="mobile-menu-toggle">
164
+ <i data-feather="menu" class="w-5 h-5"></i>
165
+ </button>
166
+ </div>
167
+ </nav>
168
+ <div class="mobile-menu" id="mobile-menu">
169
+ <a href="/">Home</a>
170
+ <a href="/shop.html">Shop</a>
171
+ <a href="/new-arrivals.html">New Arrivals</a>
172
+ <a href="/sale.html">Sale</a>
173
+ <a href="/about.html">About</a>
174
+ <a href="/contact.html">Contact</a>
175
+ </div>
176
+ </header>
177
+ `;
178
+
179
+ // Initialize feather icons after DOM is ready
180
+ setTimeout(() => {
181
+ if (typeof feather !== 'undefined') {
182
+ feather.replace();
183
+ }
184
+ }, 100);
185
+
186
+ // Mobile menu toggle
187
+ const toggleBtn = this.shadowRoot.getElementById('mobile-menu-toggle');
188
+ const mobileMenu = this.shadowRoot.getElementById('mobile-menu');
189
+
190
+ toggleBtn.addEventListener('click', () => {
191
+ mobileMenu.classList.toggle('open');
192
+ // Update icon
193
+ const icon = toggleBtn.querySelector('i');
194
+ if (mobileMenu.classList.contains('open')) {
195
+ icon.setAttribute('data-feather', 'x');
196
+ } else {
197
+ icon.setAttribute('data-feather', 'menu');
198
+ }
199
+ feather.replace();
200
+ });
201
+
202
+ // Cart interaction
203
+ const cartBtn = this.shadowRoot.querySelector('.cart-btn');
204
+ cartBtn.addEventListener('click', () => {
205
+ // Dispatch event to open cart drawer (handled by main script)
206
+ document.dispatchEvent(new CustomEvent('open-cart'));
207
+ });
208
+
209
+ // Search interaction
210
+ const searchBtn = this.shadowRoot.querySelector('.search-btn');
211
+ searchBtn.addEventListener('click', () => {
212
+ // Show search modal
213
+ document.dispatchEvent(new CustomEvent('open-search'));
214
+ });
215
+ }
216
+ }
217
+
218
+ customElements.define('custom-navbar', CustomNavbar);
index.html CHANGED
@@ -1,3 +1,4 @@
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
  <head>
@@ -9,36 +10,12 @@
9
  <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
  <script src="https://unpkg.com/feather-icons"></script>
11
  <link rel="stylesheet" href="style.css">
 
12
  </head>
13
  <body class="bg-gray-50">
14
- <!-- Header -->
15
- <header class="bg-white shadow-sm sticky top-0 z-40">
16
- <nav class="container mx-auto px-4 py-4 flex items-center justify-between">
17
- <div class="flex items-center space-x-8">
18
- <h1 class="text-2xl font-bold text-indigo-600">ShopSparkle</h1>
19
- <div class="hidden md:flex space-x-6">
20
- <a href="#" class="text-gray-700 hover:text-indigo-600 transition">Shop</a>
21
- <a href="#" class="text-gray-700 hover:text-indigo-600 transition">New Arrivals</a>
22
- <a href="#" class="text-gray-700 hover:text-indigo-600 transition">Sale</a>
23
- <a href="#" class="text-gray-700 hover:text-indigo-600 transition">About</a>
24
- </div>
25
- </div>
26
- <div class="flex items-center space-x-4">
27
- <button class="p-2 hover:bg-gray-100 rounded-lg transition">
28
- <i data-feather="search" class="w-5 h-5"></i>
29
- </button>
30
- <button class="p-2 hover:bg-gray-100 rounded-lg transition relative">
31
- <i data-feather="shopping-cart" class="w-5 h-5"></i>
32
- <span id="cart-count" class="absolute -top-1 -right-1 bg-indigo-600 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center">0</span>
33
- </button>
34
- <button class="p-2 hover:bg-gray-100 rounded-lg transition">
35
- <i data-feather="user" class="w-5 h-5"></i>
36
- </button>
37
- </div>
38
- </nav>
39
- </header>
40
-
41
- <!-- Hero Carousel Section -->
42
  <section class="relative overflow-hidden bg-white">
43
  <div class="carousel-container relative h-96 md:h-[600px]">
44
  <div class="carousel-track flex transition-transform duration-500 ease-in-out h-full" id="carousel-track">
@@ -332,9 +309,8 @@
332
  </div>
333
  </div>
334
  </footer>
335
-
336
  <script src="script.js"></script>
337
  <script>feather.replace();</script>
338
- <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
339
  </body>
340
- </html>
 
1
+
2
  <!DOCTYPE html>
3
  <html lang="en">
4
  <head>
 
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
  <link rel="stylesheet" href="style.css">
13
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
14
  </head>
15
  <body class="bg-gray-50">
16
+ <!-- Custom Navbar Component -->
17
+ <custom-navbar></custom-navbar>
18
+ <!-- Hero Carousel Section -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  <section class="relative overflow-hidden bg-white">
20
  <div class="carousel-container relative h-96 md:h-[600px]">
21
  <div class="carousel-track flex transition-transform duration-500 ease-in-out h-full" id="carousel-track">
 
309
  </div>
310
  </div>
311
  </footer>
312
+ <script src="components/navbar.js"></script>
313
  <script src="script.js"></script>
314
  <script>feather.replace();</script>
 
315
  </body>
316
+ </html>
script.js CHANGED
@@ -1,160 +1,177 @@
1
- // Carousel functionality
2
- let currentSlide = 0;
3
- const slides = document.querySelectorAll('.carousel-slide');
4
- const totalSlides = slides.length;
5
- const track = document.getElementById('carousel-track');
6
-
7
- function updateCarousel() {
8
- track.style.transform = `translateX(-${currentSlide * 100}%)`;
9
-
10
- // Update dots
11
- document.querySelectorAll('.carousel-dot').forEach((dot, index) => {
12
- if (index === currentSlide) {
13
- dot.classList.add('bg-white');
14
- dot.classList.remove('bg-white/50');
15
- } else {
16
- dot.classList.remove('bg-white');
17
- dot.classList.add('bg-white/50');
18
- }
19
- });
20
- }
21
 
22
- function nextSlide() {
23
- currentSlide = (currentSlide + 1) % totalSlides;
24
- updateCarousel();
25
- }
26
-
27
- function prevSlide() {
28
- currentSlide = (currentSlide - 1 + totalSlides) % totalSlides;
29
- updateCarousel();
30
- }
31
 
32
- function goToSlide(index) {
33
- currentSlide = index;
34
- updateCarousel();
35
- }
 
 
36
 
37
- // Auto-play carousel
38
- setInterval(nextSlide, 5000);
 
 
 
39
 
40
- // Color selector
41
- let selectedColor = 'Midnight Black';
42
- function selectColor(color, className) {
43
- selectedColor = color;
44
- document.getElementById('selected-color').textContent = color;
45
-
46
- // Update border colors
47
- document.querySelectorAll('.color-btn').forEach(btn => {
48
- btn.classList.remove('border-indigo-600');
49
- btn.classList.add('border-gray-300');
50
- });
51
- event.target.classList.remove('border-gray-300');
52
- event.target.classList.add('border-indigo-600');
53
- }
54
 
55
- // Size selector
56
- let selectedSize = 'Medium';
57
- function selectSize(size) {
58
- selectedSize = size;
59
-
60
- // Update button styles
61
- document.querySelectorAll('.size-btn').forEach(btn => {
62
- btn.classList.remove('border-indigo-600', 'bg-indigo-50');
63
- btn.classList.add('border-gray-300');
64
- });
65
- event.target.classList.remove('border-gray-300');
66
- event.target.classList.add('border-indigo-600', 'bg-indigo-50');
67
- }
68
-
69
- // Quantity controls
70
- function increaseQuantity() {
71
- const input = document.getElementById('quantity');
72
- input.value = parseInt(input.value) + 1;
73
- }
74
-
75
- function decreaseQuantity() {
76
- const input = document.getElementById('quantity');
77
- if (parseInt(input.value) > 1) {
78
- input.value = parseInt(input.value) - 1;
79
- }
80
- }
81
 
82
- // Cart functionality
83
- let cartCount = 0;
84
- function addToCart() {
85
- const quantity = document.getElementById('quantity').value;
86
- cartCount += parseInt(quantity);
87
- document.getElementById('cart-count').textContent = cartCount;
88
-
89
- // Show toast notification
90
- showToast(`Added ${quantity} item(s) to cart!`);
91
-
92
- // Add pulse animation to cart icon
93
- const cartIcon = document.querySelector('[data-feather="shopping-cart"]').parentElement;
94
- cartIcon.classList.add('animate-pulse');
95
- setTimeout(() => {
96
- cartIcon.classList.remove('animate-pulse');
97
- }, 1000);
98
- }
99
-
100
- // Toast notification
101
- function showToast(message) {
102
- const toast = document.createElement('div');
103
- toast.className = 'toast';
104
- toast.textContent = message;
105
- document.body.appendChild(toast);
106
-
107
- setTimeout(() => {
108
- toast.style.animation = 'slideOut 0.3s ease-in forwards';
109
- setTimeout(() => {
110
- document.body.removeChild(toast);
111
- }, 300);
112
- }, 3000);
113
- }
114
-
115
- // Add slide out animation
116
- const style = document.createElement('style');
117
- style.textContent = `
118
- @keyframes slideOut {
119
- from {
120
- transform: translateX(0);
121
- opacity: 1;
122
  }
123
- to {
124
- transform: translateX(100%);
125
- opacity: 0;
 
126
  }
 
 
 
 
 
 
 
 
127
  }
128
- `;
129
- document.head.appendChild(style);
130
-
131
- // Smooth scroll for anchor links
132
- document.querySelectorAll('a[href^="#"]').forEach(anchor => {
133
- anchor.addEventListener('click', function (e) {
134
- e.preventDefault();
135
- const target = document.querySelector(this.getAttribute('href'));
136
- if (target) {
137
- target.scrollIntoView({
138
- behavior: 'smooth',
139
- block: 'start'
140
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  });
143
- });
144
 
145
- // Lazy loading for images (if needed)
146
- const imageObserver = new IntersectionObserver((entries, observer) => {
147
- entries.forEach(entry => {
148
- if (entry.isIntersecting) {
149
- const img = entry.target;
150
- img.src = img.dataset.src;
151
- img.classList.remove('loading');
152
- observer.unobserve(img);
153
- }
 
 
 
 
 
 
 
154
  });
155
- });
156
 
157
- // Initialize feather icons after DOM loads
158
- document.addEventListener('DOMContentLoaded', () => {
159
- feather.replace();
160
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
+ // Global state
3
+ let currentSlide = 0;
4
+ let cartCount = 0;
5
+ let selectedColor = 'Midnight Black';
6
+ let selectedSize = 'Medium';
 
 
 
 
7
 
8
+ // Initialize
9
+ document.addEventListener('DOMContentLoaded', () => {
10
+ // Feather icons
11
+ if (typeof feather !== 'undefined') {
12
+ feather.replace();
13
+ }
14
 
15
+ // Carousel
16
+ const track = document.getElementById('carousel-track');
17
+ if (track) {
18
+ const slides = document.querySelectorAll('.carousel-slide');
19
+ const totalSlides = slides.length;
20
 
21
+ function updateCarousel() {
22
+ track.style.transform = `translateX(-${currentSlide * 100}%)`;
23
+
24
+ // Update dots
25
+ document.querySelectorAll('.carousel-dot').forEach((dot, index) => {
26
+ if (index === currentSlide) {
27
+ dot.classList.add('bg-white');
28
+ dot.classList.remove('bg-white/50');
29
+ } else {
30
+ dot.classList.remove('bg-white');
31
+ dot.classList.add('bg-white/50');
32
+ }
33
+ });
34
+ }
35
 
36
+ function nextSlide() {
37
+ const slides = document.querySelectorAll('.carousel-slide');
38
+ const totalSlides = slides.length;
39
+ currentSlide = (currentSlide + 1) % totalSlides;
40
+ updateCarousel();
41
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
+ function prevSlide() {
44
+ const slides = document.querySelectorAll('.carousel-slide');
45
+ const totalSlides = slides.length;
46
+ currentSlide = (currentSlide - 1 + totalSlides) % totalSlides;
47
+ updateCarousel();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
+
50
+ function goToSlide(index) {
51
+ currentSlide = index;
52
+ updateCarousel();
53
  }
54
+
55
+ // Auto-play
56
+ setInterval(nextSlide, 5000);
57
+
58
+ // Expose functions globally
59
+ window.nextSlide = nextSlide;
60
+ window.prevSlide = prevSlide;
61
+ window.goToSlide = goToSlide;
62
  }
63
+
64
+ // Color selector
65
+ window.selectColor = (color, className) => {
66
+ selectedColor = color;
67
+ const el = document.getElementById('selected-color');
68
+ if (el) el.textContent = color;
69
+
70
+ // Update border colors
71
+ document.querySelectorAll('.color-btn').forEach(btn => {
72
+ btn.classList.remove('border-indigo-600');
73
+ btn.classList.add('border-gray-300');
 
74
  });
75
+ event.target.classList.remove('border-gray-300');
76
+ event.target.classList.add('border-indigo-600');
77
+ };
78
+
79
+ // Size selector
80
+ window.selectSize = (size) => {
81
+ selectedSize = size;
82
+
83
+ // Update button styles
84
+ document.querySelectorAll('.size-btn').forEach(btn => {
85
+ btn.classList.remove('border-indigo-600', 'bg-indigo-50');
86
+ btn.classList.add('border-gray-300');
87
+ });
88
+ event.target.classList.remove('border-gray-300');
89
+ event.target.classList.add('border-indigo-600', 'bg-indigo-50');
90
+ };
91
+
92
+ // Quantity
93
+ window.increaseQuantity = () => {
94
+ const input = document.getElementById('quantity');
95
+ if (input) input.value = parseInt(input.value) + 1;
96
+ };
97
+
98
+ window.decreaseQuantity = () => {
99
+ const input = document.getElementById('quantity');
100
+ if (input && parseInt(input.value) > 1) {
101
+ input.value = parseInt(input.value) - 1;
102
  }
103
+ };
104
+
105
+ // Cart
106
+ window.addToCart = (productName, price) => {
107
+ let quantity = 1;
108
+ const qtyInput = document.getElementById('quantity');
109
+ if (qtyInput) quantity = parseInt(qtyInput.value);
110
+ cartCount += quantity;
111
+
112
+ // Update cart badge in navbar component
113
+ const badge = document.querySelector('custom-navbar')?.shadowRoot?.querySelector('.cart-badge');
114
+ if (badge) badge.textContent = cartCount;
115
+
116
+ // Also update in header if present
117
+ const headerBadge = document.getElementById('cart-count');
118
+ if (headerBadge) headerBadge.textContent = cartCount;
119
+
120
+ // Toast
121
+ showToast(`Added ${quantity} × ${productName || 'item'} to cart!`);
122
+ };
123
+
124
+ // Toast
125
+ window.showToast = (message) => {
126
+ const toast = document.createElement('div');
127
+ toast.className = 'toast';
128
+ toast.textContent = message;
129
+ document.body.appendChild(toast);
130
+
131
+ setTimeout(() => {
132
+ toast.style.animation = 'slideOut 0.3s ease-in forwards';
133
+ setTimeout(() => {
134
+ document.body.removeChild(toast);
135
+ }, 300);
136
+ }, 3000);
137
+ };
138
+
139
+ // Event listeners for custom components
140
+ document.addEventListener('open-cart', () => {
141
+ // Open cart drawer (simulate)
142
+ showToast('Cart opened!');
143
  });
 
144
 
145
+ document.addEventListener('open-search', () => {
146
+ // Open search modal
147
+ const modal = document.createElement('div');
148
+ modal.className = 'fixed inset-0 bg-black/50 z-50 flex items-center justify-center">
149
+ <div class="bg-white p-8 rounded-2xl max-w-2xl w-full mx-4">
150
+ <h3 class="text-2xl font-bold mb-4">Search Products</h3>
151
+ <input type="text" class="w-full border p-4 rounded-lg" placeholder="Type product name...">
152
+ </div>
153
+ );
154
+ document.body.appendChild(modal);
155
+ modal.querySelector('input').focus();
156
+ modal.addEventListener('click', (e) => {
157
+ if (e.target === modal) {
158
+ document.body.removeChild(modal);
159
+ }
160
+ });
161
  });
 
162
 
163
+ // Lazy load images
164
+ const lazyImages = document.querySelectorAll('img[data-src]');
165
+ if (lazyImages.length > 0) {
166
+ const imageObserver = new IntersectionObserver((entries) => {
167
+ entries.forEach(entry => {
168
+ if (entry.isIntersecting) {
169
+ const img = entry.target;
170
+ img.src = img.dataset.src;
171
+ img.classList.remove('loading');
172
+ imageObserver.unobserve(img);
173
+ }
174
+ });
175
+ lazyImages.forEach(img => imageObserver.observe(img));
176
+ }
177
+ });
shop.html ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Shop - ShopSparkle</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
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://unpkg.com/feather-icons"></script>
11
+ <link rel="stylesheet" href="style.css">
12
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
13
+ </head>
14
+ <body class="bg-gray-50">
15
+ <custom-navbar></custom-navbar>
16
+
17
+ <main class="container mx-auto px-4 py-12">
18
+ <div class="mb-12">
19
+ <h1 class="text-4xl font-bold text-gray-900 mb-6">Shop All Products</h1>
20
+ <div class="flex flex-wrap gap-4 items-center justify-between">
21
+ <div class="text-gray-600">Explore our curated collection of premium tech products.</div>
22
+ <div class="flex gap-3">
23
+ <button class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition">Filter <i class="fas fa-sliders-h ml-2"></i></button>
24
+ <button class="px-4 py-2 bg-white border rounded-lg hover:bg-gray-50 transition">Sort by: Featured <i class="fas fa-chevron-down ml-2"></i></button>
25
+ </div>
26
+ </div>
27
+
28
+ <!-- Product Grid -->
29
+ <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8">
30
+ <!-- Product 1 -->
31
+ <div class="product-card bg-white rounded-xl overflow-hidden shadow-lg">
32
+ <div class="relative">
33
+ <img src="http://static.photos/technology/320x240/301" alt="Wireless Headphones" class="w-full h-64 object-cover">
34
+ <span class="absolute top-4 left-4 bg-red-500 text-white text-xs px-3 py-1 rounded-full">SALE</span>
35
+ </div>
36
+ <div class="p-6">
37
+ <h3 class="text-xl font-bold mb-2">Wireless Headphones Pro</h3>
38
+ <p class="text-gray-500 text-sm mb-4">Noise cancelling, 30h battery</p>
39
+ <div class="flex items-center justify-between">
40
+ <span class="text-2xl font-bold text-indigo-600">$299.99</span>
41
+ <button onclick="addToCart('Wireless Headphones Pro', 299.99)" class="bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700 transition">Add to Cart</button>
42
+ </div>
43
+ </div>
44
+ </div>
45
+ <!-- Product 2 -->
46
+ <div class="product-card bg-white rounded-xl overflow-hidden shadow-lg">
47
+ <img src="http://static.photos/technology/320x240/302" alt="Smart Watch" class="w-full h-64 object-cover">
48
+ <div class="p-6">
49
+ <h3 class="text-xl font-bold mb-2">Smart Watch Ultra</h3>
50
+ <p class="text-gray-500 text-sm mb-4">Fitness tracking, heart rate monitor</p>
51
+ <div class="flex items-center justify-between">
52
+ <span class="text-2xl font-bold text-indigo-600">$249.99</span>
53
+ <button onclick="addToCart('Smart Watch Ultra', 249.99)" class="bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700 transition">Add to Cart</button>
54
+ </div>
55
+ </div>
56
+ <!-- Product 3 -->
57
+ <div class="product-card bg-white rounded-xl overflow-hidden shadow-lg">
58
+ <img src="http://static.photos/technology/320x240/303" alt="Portable Speaker" class="w-full h-64 object-cover">
59
+ <div class="p-6">
60
+ <h3 class="text-xl font-bold mb-2">Bluetooth Speaker Max</h3>
61
+ <p class="text-gray-500 text-sm mb-4">360° sound, waterproof</p>
62
+ <div class="flex items-center justify-between">
63
+ <span class="text-2xl font-bold text-indigo-600">$89.99</span>
64
+ <button onclick="addToCart('Bluetooth Speaker Max', 89.99)" class="bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700 transition">Add to Cart</button>
65
+ </div>
66
+ </div>
67
+ <!-- Product 4 -->
68
+ <div class="product-card bg-white rounded-xl overflow-hidden shadow-lg">
69
+ <img src="http://static.photos/technology/320x240/304" alt="Gaming Mouse" class="w-full h-64 object-cover">
70
+ <div class="p-6">
71
+ <h3 class="text-xl font-bold mb-2">RGB Gaming Mouse</h3>
72
+ <p class="text-gray-500 text-sm mb-4">16,000 DPI, programmable buttons</p>
73
+ <div class="flex items-center justify-between">
74
+ <span class="text-2xl font-bold text-indigo-600">$59.99</span>
75
+ <button onclick="addToCart('RGB Gaming Mouse', 59.99)" class="bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700 transition">Add to Cart</button>
76
+ </div>
77
+ </div>
78
+ </div>
79
+
80
+ <!-- Pagination -->
81
+ <div class="mt-16 flex justify-center">
82
+ <nav class="flex space-x-2">
83
+ <a href="#" class="px-4 py-2 bg-indigo-600 text-white rounded-lg">1</a>
84
+ <a href="#" class="px-4 py-2 bg-white border rounded-lg hover:bg-gray-50 transition">2</a>
85
+ <a href="#" class="px-4 py-2 bg-white border rounded-lg hover:bg-gray-50 transition">3</a>
86
+ <a href="#" class="px-4 py-2 bg-white border rounded-lg hover:bg-gray-50 transition">Next →</a>
87
+ </nav>
88
+ </div>
89
+ </main>
90
+
91
+ <custom-footer></custom-footer>
92
+
93
+ <script src="components/navbar.js"></script>
94
+ <script src="components/footer.js"></script>
95
+ <script src="script.js"></script>
96
+ <script>feather.replace();</script>
97
+ </body>
98
+ </html>
style.css CHANGED
@@ -1,33 +1,12 @@
1
- /* Custom animations and transitions */
2
- @keyframes fadeIn {
3
- from { opacity: 0; transform: translateY(10px); }
4
- to { opacity: 1; transform: translateY(0); }
5
- }
6
-
7
- .carousel-slide {
8
- animation: fadeIn 0.5s ease-in-out;
9
- }
10
 
11
- .color-btn, .size-btn {
12
- transition: all 0.3s ease;
13
- }
14
-
15
- .color-btn:hover {
16
- transform: scale(1.1);
17
- }
18
-
19
- .size-btn:hover {
20
- background-color: rgb(238 242 255);
21
- }
22
-
23
- /* Smooth scroll behavior */
24
  html {
25
  scroll-behavior: smooth;
26
  }
27
 
28
  /* Custom scrollbar */
29
  ::-webkit-scrollbar {
30
- width: 10px;
31
  }
32
 
33
  ::-webkit-scrollbar-track {
@@ -35,36 +14,18 @@ html {
35
  }
36
 
37
  ::-webkit-scrollbar-thumb {
38
- background: #6366f1;
39
- border-radius: 5px;
40
  }
41
 
42
  ::-webkit-scrollbar-thumb:hover {
43
- background: #4f46e5;
44
- }
45
-
46
- /* Loading animation */
47
- @keyframes pulse {
48
- 0%, 100% { opacity: 1; }
49
- 50% { opacity: 0.5; }
50
- }
51
-
52
- .loading {
53
- animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
54
  }
55
 
56
- /* Toast notification styles */
57
- .toast {
58
- position: fixed;
59
- bottom: 20px;
60
- right: 20px;
61
- background: #10b981;
62
- color: white;
63
- padding: 16px 24px;
64
- border-radius: 8px;
65
- box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
66
- z-index: 1000;
67
- animation: slideIn 0.3s ease-out;
68
  }
69
 
70
  @keyframes slideIn {
@@ -78,18 +39,78 @@ html {
78
  }
79
  }
80
 
81
- /* Hover effects for product cards */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  .product-card {
83
- transition: transform 0.3s ease, box-shadow 0.3s ease;
84
  }
85
 
86
  .product-card:hover {
87
- transform: translateY(-5px);
88
- box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
89
  }
90
 
91
- /* Button hover effects */
92
  .btn-primary {
 
93
  position: relative;
94
  overflow: hidden;
95
  }
@@ -102,7 +123,7 @@ html {
102
  width: 0;
103
  height: 0;
104
  border-radius: 50%;
105
- background: rgba(255, 255, 255, 0.3);
106
  transform: translate(-50%, -50%);
107
  transition: width 0.6s, height 0.6s;
108
  }
@@ -112,9 +133,31 @@ html {
112
  height: 300px;
113
  }
114
 
115
- /* Responsive adjustments */
116
  @media (max-width: 768px) {
117
  .carousel-track {
118
  height: 400px;
119
  }
120
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
+ /* Base */
 
 
 
 
 
 
 
 
 
 
 
 
3
  html {
4
  scroll-behavior: smooth;
5
  }
6
 
7
  /* Custom scrollbar */
8
  ::-webkit-scrollbar {
9
+ width: 12px;
10
  }
11
 
12
  ::-webkit-scrollbar-track {
 
14
  }
15
 
16
  ::-webkit-scrollbar-thumb {
17
+ background: linear-gradient(45deg, #667eea, #764ba2);
18
+ border-radius: 6px;
19
  }
20
 
21
  ::-webkit-scrollbar-thumb:hover {
22
+ background: linear-gradient(45deg, #5a67d8, #6b46c1);
 
 
 
 
 
 
 
 
 
 
23
  }
24
 
25
+ /* Animations */
26
+ @keyframes fadeIn {
27
+ from { opacity: 0; transform: translateY(20px); }
28
+ to { opacity: 1; transform: translateY(0); }
 
 
 
 
 
 
 
 
29
  }
30
 
31
  @keyframes slideIn {
 
39
  }
40
  }
41
 
42
+ @keyframes slideOut {
43
+ from {
44
+ transform: translateX(0);
45
+ opacity: 1;
46
+ }
47
+ to {
48
+ transform: translateX(100%);
49
+ opacity: 0;
50
+ }
51
+ }
52
+
53
+ @keyframes pulse {
54
+ 0%, 100% { opacity: 1; }
55
+ 50% { opacity: 0.6; }
56
+ }
57
+
58
+ @keyframes float {
59
+ 0%, 100% { transform: translateY(0); }
60
+ 50% { transform: translateY(-10px); }
61
+ }
62
+
63
+ @keyframes shimmer {
64
+ 0% { background-position: -200px 0; }
65
+ 100% { background-position: 200px 0; }
66
+ }
67
+
68
+ /* Components */
69
+ .carousel-slide {
70
+ animation: fadeIn 0.8s ease-out;
71
+ }
72
+
73
+ .color-btn, .size-btn {
74
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
75
+ }
76
+
77
+ .color-btn:hover {
78
+ transform: scale(1.15);
79
+ }
80
+
81
+ .size-btn:hover {
82
+ background-color: rgb(238 242 255);
83
+ }
84
+
85
+ /* Toast */
86
+ .toast {
87
+ position: fixed;
88
+ bottom: 24px;
89
+ right: 24px;
90
+ background: linear-gradient(90deg, #10b981, #34d399);
91
+ color: white;
92
+ padding: 16px 24px;
93
+ border-radius: 12px;
94
+ box-shadow: 0 20px 25px -5px rgba(16, 185, 129, 0.25);
95
+ z-index: 1000;
96
+ animation: slideIn 0.4s ease-out;
97
+ font-weight: 500;
98
+ backdrop-filter: blur(8px);
99
+ }
100
+
101
+ /* Cards */
102
  .product-card {
103
+ transition: transform 0.4s ease, box-shadow 0.4s ease;
104
  }
105
 
106
  .product-card:hover {
107
+ transform: translateY(-12px);
108
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
109
  }
110
 
111
+ /* Buttons */
112
  .btn-primary {
113
+ background: linear-gradient(90deg, #667eea, #764ba2);
114
  position: relative;
115
  overflow: hidden;
116
  }
 
123
  width: 0;
124
  height: 0;
125
  border-radius: 50%;
126
+ background: rgba(255, 255, 255, 0.2);
127
  transform: translate(-50%, -50%);
128
  transition: width 0.6s, height 0.6s;
129
  }
 
133
  height: 300px;
134
  }
135
 
136
+ /* Responsive */
137
  @media (max-width: 768px) {
138
  .carousel-track {
139
  height: 400px;
140
  }
141
+ }
142
+
143
+ /* New */
144
+ .shimmer {
145
+ background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
146
+ background-size: 200px 100%;
147
+ animation: shimmer 1.5s infinite linear;
148
+ }
149
+
150
+ .float {
151
+ animation: float 3s ease-in-out infinite;
152
+ }
153
+
154
+ .glass {
155
+ background: rgba(255, 255, 255, 0.15);
156
+ backdrop-filter: blur(10px);
157
+ border: 1px solid rgba(255, 255, 255, 0.2);
158
+ }
159
+
160
+ /* Navbar adjustments */
161
+ custom-navbar {
162
+ display: block;
163
+ }