File size: 34,153 Bytes
1fb3b02 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>T-Shirt Store | AyoubShop</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.product-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
.cart-item-enter {
opacity: 0;
transform: translateX(20px);
}
.cart-item-enter-active {
opacity: 1;
transform: translateX(0);
transition: all 300ms ease-in;
}
.cart-item-exit {
opacity: 1;
}
.cart-item-exit-active {
opacity: 0;
transform: translateX(20px);
transition: all 300ms ease-in;
}
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.05); }
}
.cart-pulse {
animation: pulse 1.5s infinite;
}
</style>
</head>
<body class="bg-gray-50">
<!-- Header/Navigation -->
<header class="bg-white shadow-sm sticky top-0 z-50">
<div class="container mx-auto px-4 py-4 flex justify-between items-center">
<div class="flex items-center">
<a href="#" class="text-2xl font-bold text-indigo-600">TeeShop</a>
</div>
<nav class="hidden md:flex space-x-8">
<a href="#" class="text-gray-800 hover:text-indigo-600">Home</a>
<a href="#shop" class="text-gray-800 hover:text-indigo-600">Shop</a>
<a href="#about" class="text-gray-800 hover:text-indigo-600">About</a>
<a href="#contact" class="text-gray-800 hover:text-indigo-600">Contact</a>
</nav>
<div class="flex items-center space-x-4">
<button id="cartBtn" class="relative">
<i class="fas fa-shopping-cart text-gray-700 text-xl"></i>
<span id="cartCount" class="absolute -top-2 -right-2 bg-indigo-600 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center">0</span>
</button>
<button class="md:hidden" id="mobileMenuBtn">
<i class="fas fa-bars text-gray-700 text-xl"></i>
</button>
</div>
</div>
<!-- Mobile Menu -->
<div id="mobileMenu" class="hidden md:hidden bg-white py-2 px-4 shadow-md">
<a href="#" class="block py-2 text-gray-800 hover:text-indigo-600">Home</a>
<a href="#shop" class="block py-2 text-gray-800 hover:text-indigo-600">Shop</a>
<a href="#about" class="block py-2 text-gray-800 hover:text-indigo-600">About</a>
<a href="#contact" class="block py-2 text-gray-800 hover:text-indigo-600">Contact</a>
</div>
</header>
<!-- Hero Section -->
<section class="bg-gradient-to-r from-indigo-500 to-purple-600 text-white py-16 md:py-24">
<div class="container mx-auto px-4 flex flex-col md:flex-row items-center">
<div class="md:w-1/2 mb-8 md:mb-0">
<h1 class="text-4xl md:text-5xl font-bold mb-4">Premium Quality T-Shirts</h1>
<p class="text-xl mb-6">Comfortable, stylish, and made to last. Find your perfect tee today.</p>
<a href="#shop" class="bg-white text-indigo-600 px-6 py-3 rounded-lg font-medium hover:bg-gray-100 transition duration-300 inline-block">Shop Now</a>
</div>
<div class="md:w-1/2 flex justify-center">
<img src="https://images.unsplash.com/photo-1521572163474-6864f9cf17ab?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=880&q=80" alt="T-Shirt Display" class="rounded-lg shadow-xl max-w-full h-auto max-h-96">
</div>
</div>
</section>
<!-- Featured Products -->
<section id="shop" class="py-16 bg-white">
<div class="container mx-auto px-4">
<h2 class="text-3xl font-bold text-center mb-12">Our T-Shirt Collection</h2>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8">
<!-- Product 1 -->
<div class="product-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
<div class="relative">
<img src="https://images.unsplash.com/photo-1527719327859-c6ce80353573?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=774&q=80" alt="Graphic T-Shirt" class="w-full h-64 object-cover">
<div class="absolute top-2 right-2 bg-indigo-600 text-white text-xs px-2 py-1 rounded">Bestseller</div>
</div>
<div class="p-4">
<h3 class="font-semibold text-lg mb-1">Urban Explorer</h3>
<p class="text-gray-600 text-sm mb-2">Graphic Print T-Shirt</p>
<div class="flex justify-between items-center">
<span class="font-bold text-indigo-600">$24.99</span>
<button class="add-to-cart bg-indigo-600 text-white px-3 py-1 rounded text-sm hover:bg-indigo-700 transition" data-id="1" data-name="Urban Explorer" data-price="24.99" data-image="https://images.unsplash.com/photo-1527719327859-c6ce80353573?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=774&q=80">
Add to Cart
</button>
</div>
</div>
</div>
<!-- Product 2 -->
<div class="product-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
<div class="relative">
<img src="https://images.unsplash.com/photo-1576566588028-4147f3842f27?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1064&q=80" alt="Plain T-Shirt" class="w-full h-64 object-cover">
</div>
<div class="p-4">
<h3 class="font-semibold text-lg mb-1">Classic Comfort</h3>
<p class="text-gray-600 text-sm mb-2">Basic Cotton T-Shirt</p>
<div class="flex justify-between items-center">
<span class="font-bold text-indigo-600">$19.99</span>
<button class="add-to-cart bg-indigo-600 text-white px-3 py-1 rounded text-sm hover:bg-indigo-700 transition" data-id="2" data-name="Classic Comfort" data-price="19.99" data-image="https://images.unsplash.com/photo-1576566588028-4147f3842f27?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1064&q=80">
Add to Cart
</button>
</div>
</div>
</div>
<!-- Product 3 -->
<div class="product-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
<div class="relative">
<img src="https://images.unsplash.com/photo-1598033129183-c4f50c736ef7?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1025&q=80" alt="Vintage T-Shirt" class="w-full h-64 object-cover">
<div class="absolute top-2 right-2 bg-yellow-500 text-white text-xs px-2 py-1 rounded">Sale</div>
</div>
<div class="p-4">
<h3 class="font-semibold text-lg mb-1">Retro Vibes</h3>
<p class="text-gray-600 text-sm mb-2">Vintage Washed T-Shirt</p>
<div class="flex justify-between items-center">
<div>
<span class="font-bold text-indigo-600">$22.99</span>
<span class="text-gray-400 text-sm line-through ml-2">$29.99</span>
</div>
<button class="add-to-cart bg-indigo-600 text-white px-3 py-1 rounded text-sm hover:bg-indigo-700 transition" data-id="3" data-name="Retro Vibes" data-price="22.99" data-image="https://images.unsplash.com/photo-1598033129183-c4f50c736ef7?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1025&q=80">
Add to Cart
</button>
</div>
</div>
</div>
<!-- Product 4 -->
<div class="product-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300">
<div class="relative">
<img src="https://images.unsplash.com/photo-1620799140408-edc6dcb6d633?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1072&q=80" alt="Pocket T-Shirt" class="w-full h-64 object-cover">
</div>
<div class="p-4">
<h3 class="font-semibold text-lg mb-1">Essential Pocket</h3>
<p class="text-gray-600 text-sm mb-2">Pocket Detail T-Shirt</p>
<div class="flex justify-between items-center">
<span class="font-bold text-indigo-600">$26.99</span>
<button class="add-to-cart bg-indigo-600 text-white px-3 py-1 rounded text-sm hover:bg-indigo-700 transition" data-id="4" data-name="Essential Pocket" data-price="26.99" data-image="https://images.unsplash.com/photo-1620799140408-edc6dcb6d633?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1072&q=80">
Add to Cart
</button>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- About Section -->
<section id="about" class="py-16 bg-gray-100">
<div class="container mx-auto px-4">
<div class="flex flex-col md:flex-row items-center">
<div class="md:w-1/2 mb-8 md:mb-0 md:pr-8">
<h2 class="text-3xl font-bold mb-6">About Our T-Shirts</h2>
<p class="text-gray-700 mb-4">
We believe in creating high-quality, comfortable t-shirts that you'll love to wear every day.
Our tees are made from premium 100% cotton fabric that gets softer with every wash.
</p>
<p class="text-gray-700 mb-4">
Each design is carefully crafted to ensure both style and durability. We use eco-friendly
printing methods that are gentle on the environment and produce vibrant, long-lasting prints.
</p>
<p class="text-gray-700">
From classic fits to modern styles, we have something for everyone. Shop our collection and
experience the difference quality makes.
</p>
</div>
<div class="md:w-1/2">
<img src="https://images.unsplash.com/photo-1529374255404-311a2a4f1fd9?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1169&q=80" alt="About Our T-Shirts" class="rounded-lg shadow-lg w-full">
</div>
</div>
</div>
</section>
<!-- Testimonials -->
<section class="py-16 bg-white">
<div class="container mx-auto px-4">
<h2 class="text-3xl font-bold text-center mb-12">What Our Customers Say</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
<!-- Testimonial 1 -->
<div class="bg-gray-50 p-6 rounded-lg shadow-sm">
<div class="flex items-center mb-4">
<div class="text-yellow-400 mr-2">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
</div>
<p class="text-gray-700 mb-4">
"The quality of these t-shirts is amazing! They're so comfortable and the print hasn't faded
even after multiple washes. Will definitely be buying more."
</p>
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/women/43.jpg" alt="Sarah J." class="w-10 h-10 rounded-full mr-3">
<div>
<h4 class="font-semibold">Sarah J.</h4>
<p class="text-gray-500 text-sm">Verified Customer</p>
</div>
</div>
</div>
<!-- Testimonial 2 -->
<div class="bg-gray-50 p-6 rounded-lg shadow-sm">
<div class="flex items-center mb-4">
<div class="text-yellow-400 mr-2">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
</div>
<p class="text-gray-700 mb-4">
"I love the fit of these shirts. They're not too tight but still have a nice shape. The fabric
is breathable and perfect for summer."
</p>
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="Michael T." class="w-10 h-10 rounded-full mr-3">
<div>
<h4 class="font-semibold">Michael T.</h4>
<p class="text-gray-500 text-sm">Verified Customer</p>
</div>
</div>
</div>
<!-- Testimonial 3 -->
<div class="bg-gray-50 p-6 rounded-lg shadow-sm">
<div class="flex items-center mb-4">
<div class="text-yellow-400 mr-2">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
</div>
<p class="text-gray-700 mb-4">
"Great customer service and fast shipping. The t-shirt arrived exactly as pictured and fits
perfectly. Will be ordering more colors soon!"
</p>
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/women/65.jpg" alt="Jessica L." class="w-10 h-10 rounded-full mr-3">
<div>
<h4 class="font-semibold">Jessica L.</h4>
<p class="text-gray-500 text-sm">Verified Customer</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="py-16 bg-indigo-50">
<div class="container mx-auto px-4">
<h2 class="text-3xl font-bold text-center mb-12">Contact Us</h2>
<div class="max-w-3xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="md:flex">
<div class="md:w-1/2 bg-indigo-600 text-white p-8">
<h3 class="text-xl font-semibold mb-4">Get in Touch</h3>
<p class="mb-6">Have questions about our products or need assistance with your order? Reach out to us!</p>
<div class="mb-4 flex items-start">
<i class="fas fa-map-marker-alt mt-1 mr-3"></i>
<p>123 T-Shirt Street, Fashion District, CA 90210</p>
</div>
<div class="mb-4 flex items-center">
<i class="fas fa-phone-alt mr-3"></i>
<p>(555) 123-4567</p>
</div>
<div class="flex items-center">
<i class="fas fa-envelope mr-3"></i>
<p>info@teeshop.com</p>
</div>
</div>
<div class="md:w-1/2 p-8">
<form id="contactForm">
<div class="mb-4">
<label for="name" class="block text-gray-700 mb-2">Name</label>
<input type="text" id="name" class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
</div>
<div class="mb-4">
<label for="email" class="block text-gray-700 mb-2">Email</label>
<input type="email" id="email" class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
</div>
<div class="mb-4">
<label for="message" class="block text-gray-700 mb-2">Message</label>
<textarea id="message" rows="4" class="w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500"></textarea>
</div>
<button type="submit" class="bg-indigo-600 text-white px-6 py-2 rounded-lg hover:bg-indigo-700 transition w-full">
Send Message
</button>
</form>
</div>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="bg-gray-900 text-white py-12">
<div class="container mx-auto px-4">
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
<div>
<h3 class="text-xl font-bold mb-4">TeeShop</h3>
<p class="text-gray-400">
Premium quality t-shirts for every occasion. Comfortable, stylish, and made to last.
</p>
</div>
<div>
<h4 class="font-semibold mb-4">Quick Links</h4>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white transition">Home</a></li>
<li><a href="#shop" class="text-gray-400 hover:text-white transition">Shop</a></li>
<li><a href="#about" class="text-gray-400 hover:text-white transition">About</a></li>
<li><a href="#contact" class="text-gray-400 hover:text-white transition">Contact</a></li>
</ul>
</div>
<div>
<h4 class="font-semibold mb-4">Customer Service</h4>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white transition">Shipping Policy</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Returns & Exchanges</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Size Guide</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">FAQs</a></li>
</ul>
</div>
<div>
<h4 class="font-semibold mb-4">Connect With Us</h4>
<div class="flex space-x-4">
<a href="#" class="text-gray-400 hover:text-white transition text-xl"><i class="fab fa-facebook-f"></i></a>
<a href="#" class="text-gray-400 hover:text-white transition text-xl"><i class="fab fa-twitter"></i></a>
<a href="#" class="text-gray-400 hover:text-white transition text-xl"><i class="fab fa-instagram"></i></a>
<a href="#" class="text-gray-400 hover:text-white transition text-xl"><i class="fab fa-pinterest-p"></i></a>
</div>
<h4 class="font-semibold mt-6 mb-2">Newsletter</h4>
<div class="flex">
<input type="email" placeholder="Your email" class="px-3 py-2 text-gray-900 rounded-l focus:outline-none w-full">
<button class="bg-indigo-600 px-3 py-2 rounded-r hover:bg-indigo-700 transition">
<i class="fas fa-paper-plane"></i>
</button>
</div>
</div>
</div>
<div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500 text-sm">
<p>© 2023 TeeShop. All rights reserved.</p>
</div>
</div>
</footer>
<!-- Shopping Cart Sidebar -->
<div id="cartSidebar" class="fixed top-0 right-0 h-full w-full md:w-96 bg-white shadow-lg transform translate-x-full transition-transform duration-300 ease-in-out z-50 overflow-y-auto">
<div class="p-6">
<div class="flex justify-between items-center mb-6">
<h3 class="text-xl font-bold">Your Cart</h3>
<button id="closeCartBtn" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div id="cartItems" class="mb-6">
<!-- Cart items will be added here dynamically -->
<div class="text-center py-8 text-gray-500" id="emptyCartMessage">
<i class="fas fa-shopping-cart text-4xl mb-3"></i>
<p>Your cart is empty</p>
</div>
</div>
<div class="border-t border-gray-200 pt-4 mb-4">
<div class="flex justify-between mb-2">
<span class="font-semibold">Subtotal:</span>
<span id="cartSubtotal">$0.00</span>
</div>
<div class="flex justify-between mb-2">
<span class="font-semibold">Shipping:</span>
<span>Calculated at checkout</span>
</div>
<div class="flex justify-between text-lg font-bold">
<span>Total:</span>
<span id="cartTotal">$0.00</span>
</div>
</div>
<button id="checkoutBtn" class="bg-indigo-600 text-white w-full py-3 rounded-lg font-medium hover:bg-indigo-700 transition mb-3">
Checkout
</button>
<a href="#shop" class="block text-center text-indigo-600 hover:text-indigo-800 transition">
Continue Shopping
</a>
</div>
</div>
<div id="cartOverlay" class="hidden fixed inset-0 bg-black bg-opacity-50 z-40"></div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Mobile menu toggle
const mobileMenuBtn = document.getElementById('mobileMenuBtn');
const mobileMenu = document.getElementById('mobileMenu');
mobileMenuBtn.addEventListener('click', function() {
mobileMenu.classList.toggle('hidden');
});
// Cart functionality
const cartBtn = document.getElementById('cartBtn');
const closeCartBtn = document.getElementById('closeCartBtn');
const cartSidebar = document.getElementById('cartSidebar');
const cartOverlay = document.getElementById('cartOverlay');
const cartCount = document.getElementById('cartCount');
const cartItems = document.getElementById('cartItems');
const emptyCartMessage = document.getElementById('emptyCartMessage');
const cartSubtotal = document.getElementById('cartSubtotal');
const cartTotal = document.getElementById('cartTotal');
const checkoutBtn = document.getElementById('checkoutBtn');
let cart = [];
// Toggle cart sidebar
function toggleCart() {
cartSidebar.classList.toggle('translate-x-full');
cartOverlay.classList.toggle('hidden');
document.body.classList.toggle('overflow-hidden');
}
cartBtn.addEventListener('click', toggleCart);
closeCartBtn.addEventListener('click', toggleCart);
cartOverlay.addEventListener('click', toggleCart);
// Add to cart functionality
const addToCartButtons = document.querySelectorAll('.add-to-cart');
addToCartButtons.forEach(button => {
button.addEventListener('click', function() {
const id = this.getAttribute('data-id');
const name = this.getAttribute('data-name');
const price = parseFloat(this.getAttribute('data-price'));
const image = this.getAttribute('data-image');
// Check if item already exists in cart
const existingItem = cart.find(item => item.id === id);
if (existingItem) {
existingItem.quantity += 1;
} else {
cart.push({
id,
name,
price,
image,
quantity: 1
});
}
updateCart();
// Add pulse animation to cart icon
cartBtn.classList.add('cart-pulse');
setTimeout(() => {
cartBtn.classList.remove('cart-pulse');
}, 1500);
});
});
// Update cart UI
function updateCart() {
// Update cart count
const totalItems = cart.reduce((total, item) => total + item.quantity, 0);
cartCount.textContent = totalItems;
// Update cart items
if (cart.length === 0) {
emptyCartMessage.classList.remove('hidden');
cartItems.innerHTML = '';
} else {
emptyCartMessage.classList.add('hidden');
let itemsHTML = '';
let subtotal = 0;
cart.forEach(item => {
const itemTotal = item.price * item.quantity;
subtotal += itemTotal;
itemsHTML += `
<div class="cart-item flex items-center py-4 border-b border-gray-200">
<div class="w-16 h-16 bg-gray-100 rounded-lg overflow-hidden mr-4">
<img src="${item.image}" alt="${item.name}" class="w-full h-full object-cover">
</div>
<div class="flex-1">
<h4 class="font-medium">${item.name}</h4>
<p class="text-gray-600 text-sm">$${item.price.toFixed(2)}</p>
</div>
<div class="flex items-center">
<button class="decrease-quantity text-gray-500 px-2 py-1" data-id="${item.id}">
<i class="fas fa-minus text-xs"></i>
</button>
<span class="mx-2">${item.quantity}</span>
<button class="increase-quantity text-gray-500 px-2 py-1" data-id="${item.id}">
<i class="fas fa-plus text-xs"></i>
</button>
</div>
<div class="ml-4 font-medium">
$${itemTotal.toFixed(2)}
</div>
<button class="remove-item ml-4 text-red-500" data-id="${item.id}">
<i class="fas fa-trash"></i>
</button>
</div>
`;
});
cartItems.innerHTML = itemsHTML;
// Update totals
cartSubtotal.textContent = `$${subtotal.toFixed(2)}`;
cartTotal.textContent = `$${subtotal.toFixed(2)}`;
// Add event listeners to new buttons
document.querySelectorAll('.decrease-quantity').forEach(button => {
button.addEventListener('click', function() {
const id = this.getAttribute('data-id');
const item = cart.find(item => item.id === id);
if (item.quantity > 1) {
item.quantity -= 1;
updateCart();
}
});
});
document.querySelectorAll('.increase-quantity').forEach(button => {
button.addEventListener('click', function() {
const id = this.getAttribute('data-id');
const item = cart.find(item => item.id === id);
item.quantity += 1;
updateCart();
});
});
document.querySelectorAll('.remove-item').forEach(button => {
button.addEventListener('click', function() {
const id = this.getAttribute('data-id');
cart = cart.filter(item => item.id !== id);
updateCart();
});
});
}
}
// Checkout button
checkoutBtn.addEventListener('click', function() {
if (cart.length === 0) {
alert('Your cart is empty!');
return;
}
alert('Checkout functionality would go here!');
// In a real application, you would redirect to a checkout page
});
// Contact form submission
const contactForm = document.getElementById('contactForm');
contactForm.addEventListener('submit', function(e) {
e.preventDefault();
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const message = document.getElementById('message').value;
// Simple validation
if (!name || !email || !message) {
alert('Please fill in all fields');
return;
}
// In a real application, you would send this data to your server
alert(`Thank you for your message, ${name}! We'll get back to you soon.`);
contactForm.reset();
});
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Sonata71/teeshop" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |