Spaces:
Running
Running
File size: 42,497 Bytes
0f84517 | 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 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ShopEase - Your Online Shopping Destination</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>
/* Custom CSS for animations and effects */
.product-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px 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);
}
}
.pulse-animation {
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-3 flex justify-between items-center">
<div class="flex items-center space-x-2">
<i class="fas fa-shopping-bag text-2xl text-indigo-600"></i>
<h1 class="text-xl font-bold text-gray-800">Shop<span class="text-indigo-600">Ease</span></h1>
</div>
<div class="hidden md:flex items-center space-x-6">
<a href="#" class="text-gray-700 hover:text-indigo-600 transition">Home</a>
<a href="#products" class="text-gray-700 hover:text-indigo-600 transition">Products</a>
<a href="#deals" class="text-gray-700 hover:text-indigo-600 transition">Deals</a>
<a href="#about" class="text-gray-700 hover:text-indigo-600 transition">About</a>
</div>
<div class="flex items-center space-x-4">
<button id="search-btn" class="text-gray-600 hover:text-indigo-600">
<i class="fas fa-search"></i>
</button>
<button id="cart-btn" class="relative text-gray-600 hover:text-indigo-600">
<i class="fas fa-shopping-cart"></i>
<span id="cart-count" 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 id="mobile-menu-btn" class="md:hidden text-gray-600 hover:text-indigo-600">
<i class="fas fa-bars"></i>
</button>
</div>
</div>
<!-- Mobile Menu -->
<div id="mobile-menu" class="hidden md:hidden bg-white py-2 px-4 shadow-md">
<a href="#" class="block py-2 text-gray-700 hover:text-indigo-600">Home</a>
<a href="#products" class="block py-2 text-gray-700 hover:text-indigo-600">Products</a>
<a href="#deals" class="block py-2 text-gray-700 hover:text-indigo-600">Deals</a>
<a href="#about" class="block py-2 text-gray-700 hover:text-indigo-600">About</a>
</div>
<!-- Search Bar -->
<div id="search-bar" class="hidden bg-white py-3 px-4 shadow-sm">
<div class="container mx-auto flex">
<input type="text" placeholder="Search for products..." class="flex-grow px-4 py-2 border border-gray-300 rounded-l-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
<button class="bg-indigo-600 text-white px-4 py-2 rounded-r-lg hover:bg-indigo-700 transition">
<i class="fas fa-search"></i>
</button>
</div>
</div>
</header>
<!-- Hero Section -->
<section class="bg-gradient-to-r from-indigo-500 to-purple-600 text-white py-16">
<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">
<h2 class="text-4xl md:text-5xl font-bold mb-4">Summer Sale Up To 50% Off</h2>
<p class="text-xl mb-6">Discover amazing deals on your favorite products. Limited time offer!</p>
<div class="flex space-x-4">
<button class="bg-white text-indigo-600 px-6 py-3 rounded-lg font-medium hover:bg-gray-100 transition">Shop Now</button>
<button class="border-2 border-white text-white px-6 py-3 rounded-lg font-medium hover:bg-white hover:text-indigo-600 transition">Learn More</button>
</div>
</div>
<div class="md:w-1/2 flex justify-center">
<img src="https://images.unsplash.com/photo-1523275335684-37898b6baf30?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Featured Product" class="rounded-lg shadow-xl max-w-md w-full h-auto pulse-animation">
</div>
</div>
</section>
<!-- Categories -->
<section class="py-12 bg-white">
<div class="container mx-auto px-4">
<h2 class="text-3xl font-bold text-center mb-10 text-gray-800">Shop by Category</h2>
<div class="grid grid-cols-2 md:grid-cols-4 gap-6">
<div class="bg-gray-100 rounded-lg p-6 text-center hover:bg-indigo-50 transition cursor-pointer">
<div class="bg-indigo-100 w-16 h-16 mx-auto rounded-full flex items-center justify-center mb-4">
<i class="fas fa-tshirt text-indigo-600 text-2xl"></i>
</div>
<h3 class="font-medium text-gray-800">Fashion</h3>
</div>
<div class="bg-gray-100 rounded-lg p-6 text-center hover:bg-indigo-50 transition cursor-pointer">
<div class="bg-indigo-100 w-16 h-16 mx-auto rounded-full flex items-center justify-center mb-4">
<i class="fas fa-laptop text-indigo-600 text-2xl"></i>
</div>
<h3 class="font-medium text-gray-800">Electronics</h3>
</div>
<div class="bg-gray-100 rounded-lg p-6 text-center hover:bg-indigo-50 transition cursor-pointer">
<div class="bg-indigo-100 w-16 h-16 mx-auto rounded-full flex items-center justify-center mb-4">
<i class="fas fa-home text-indigo-600 text-2xl"></i>
</div>
<h3 class="font-medium text-gray-800">Home</h3>
</div>
<div class="bg-gray-100 rounded-lg p-6 text-center hover:bg-indigo-50 transition cursor-pointer">
<div class="bg-indigo-100 w-16 h-16 mx-auto rounded-full flex items-center justify-center mb-4">
<i class="fas fa-gamepad text-indigo-600 text-2xl"></i>
</div>
<h3 class="font-medium text-gray-800">Gaming</h3>
</div>
</div>
</div>
</section>
<!-- Featured Products -->
<section id="products" class="py-12 bg-gray-50">
<div class="container mx-auto px-4">
<div class="flex justify-between items-center mb-8">
<h2 class="text-3xl font-bold text-gray-800">Featured Products</h2>
<a href="#" class="text-indigo-600 hover:text-indigo-800 font-medium">View All</a>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6" id="products-container">
<!-- Products will be dynamically added here -->
</div>
</div>
</section>
<!-- Special Offers -->
<section id="deals" class="py-12 bg-white">
<div class="container mx-auto px-4">
<h2 class="text-3xl font-bold text-center mb-10 text-gray-800">Special Offers</h2>
<div class="bg-gradient-to-r from-yellow-400 to-orange-500 rounded-xl p-8 text-white">
<div class="flex flex-col md:flex-row items-center">
<div class="md:w-1/2 mb-6 md:mb-0">
<h3 class="text-2xl md:text-3xl font-bold mb-4">Flash Sale!</h3>
<p class="text-lg mb-4">Limited time offer on selected items. Don't miss out!</p>
<div class="flex items-center mb-4">
<div class="bg-white text-orange-500 px-3 py-1 rounded mr-2">
<span id="hours">12</span>h
</div>
<div class="bg-white text-orange-500 px-3 py-1 rounded mr-2">
<span id="minutes">45</span>m
</div>
<div class="bg-white text-orange-500 px-3 py-1 rounded">
<span id="seconds">30</span>s
</div>
</div>
<button class="bg-white text-orange-500 px-6 py-2 rounded-lg font-medium hover:bg-gray-100 transition">Shop Now</button>
</div>
<div class="md:w-1/2 flex justify-center">
<img src="https://images.unsplash.com/photo-1607082348824-0a96f2a4b9da?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Special Offer" class="rounded-lg shadow-lg max-w-xs w-full h-auto">
</div>
</div>
</div>
</div>
</section>
<!-- Testimonials -->
<section class="py-12 bg-gray-50">
<div class="container mx-auto px-4">
<h2 class="text-3xl font-bold text-center mb-10 text-gray-800">What Our Customers Say</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="bg-white 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-600 mb-4">"The quality of products is amazing and the delivery was super fast. Will definitely shop here again!"</p>
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/women/44.jpg" alt="Customer" class="w-10 h-10 rounded-full mr-3">
<div>
<h4 class="font-medium">Sarah Johnson</h4>
<p class="text-sm text-gray-500">Verified Buyer</p>
</div>
</div>
</div>
<div class="bg-white 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-600 mb-4">"Great customer service! They helped me choose the perfect gift for my wife's birthday. Highly recommended!"</p>
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="Customer" class="w-10 h-10 rounded-full mr-3">
<div>
<h4 class="font-medium">Michael Chen</h4>
<p class="text-sm text-gray-500">Verified Buyer</p>
</div>
</div>
</div>
<div class="bg-white 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-600 mb-4">"The checkout process was so smooth and my order arrived earlier than expected. Very impressed!"</p>
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/women/68.jpg" alt="Customer" class="w-10 h-10 rounded-full mr-3">
<div>
<h4 class="font-medium">Emily Rodriguez</h4>
<p class="text-sm text-gray-500">Verified Buyer</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Newsletter -->
<section class="py-12 bg-indigo-600 text-white">
<div class="container mx-auto px-4 text-center">
<h2 class="text-3xl font-bold mb-4">Subscribe to Our Newsletter</h2>
<p class="text-xl mb-6 max-w-2xl mx-auto">Get the latest updates on new products, special offers, and exclusive discounts.</p>
<div class="flex flex-col sm:flex-row max-w-md mx-auto sm:max-w-xl">
<input type="email" placeholder="Your email address" class="flex-grow px-4 py-3 rounded-l-lg sm:rounded-r-none rounded-r-lg text-gray-800 focus:outline-none">
<button class="bg-indigo-800 px-6 py-3 rounded-r-lg sm:rounded-l-none rounded-l-lg mt-2 sm:mt-0 hover:bg-indigo-900 transition">Subscribe</button>
</div>
</div>
</section>
<!-- About Section -->
<section id="about" class="py-12 bg-white">
<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">
<h2 class="text-3xl font-bold mb-6 text-gray-800">About ShopEase</h2>
<p class="text-gray-600 mb-4">Founded in 2020, ShopEase has quickly become a trusted name in online shopping, offering a wide range of high-quality products at competitive prices.</p>
<p class="text-gray-600 mb-6">Our mission is to make online shopping easy, enjoyable, and accessible to everyone, with fast shipping, excellent customer service, and a seamless shopping experience.</p>
<button class="bg-indigo-600 text-white px-6 py-3 rounded-lg font-medium hover:bg-indigo-700 transition">Learn More</button>
</div>
<div class="md:w-1/2 flex justify-center">
<img src="https://images.unsplash.com/photo-1556740738-b6a63e27c4df?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Our Team" class="rounded-lg shadow-lg max-w-md w-full h-auto">
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="bg-gray-800 text-white py-12">
<div class="container mx-auto px-4">
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
<div>
<div class="flex items-center space-x-2 mb-4">
<i class="fas fa-shopping-bag text-2xl text-indigo-400"></i>
<h3 class="text-xl font-bold">Shop<span class="text-indigo-400">Ease</span></h3>
</div>
<p class="text-gray-400 mb-4">Your one-stop shop for all your needs. Quality products, fast delivery, and excellent service.</p>
<div class="flex space-x-4">
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-facebook-f"></i></a>
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-twitter"></i></a>
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-instagram"></i></a>
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-linkedin-in"></i></a>
</div>
</div>
<div>
<h4 class="text-lg font-semibold mb-4">Quick Links</h4>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white">Home</a></li>
<li><a href="#products" class="text-gray-400 hover:text-white">Products</a></li>
<li><a href="#deals" class="text-gray-400 hover:text-white">Special Offers</a></li>
<li><a href="#about" class="text-gray-400 hover:text-white">About Us</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Contact</a></li>
</ul>
</div>
<div>
<h4 class="text-lg font-semibold mb-4">Customer Service</h4>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white">My Account</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Order Tracking</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Wishlist</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Shipping Info</a></li>
<li><a href="#" class="text-gray-400 hover:text-white">Returns & Exchanges</a></li>
</ul>
</div>
<div>
<h4 class="text-lg font-semibold mb-4">Contact Us</h4>
<ul class="space-y-2 text-gray-400">
<li class="flex items-start">
<i class="fas fa-map-marker-alt mt-1 mr-2 text-indigo-400"></i>
<span>123 Shopping Street, Retail City, 10001</span>
</li>
<li class="flex items-start">
<i class="fas fa-phone-alt mt-1 mr-2 text-indigo-400"></i>
<span>+1 (555) 123-4567</span>
</li>
<li class="flex items-start">
<i class="fas fa-envelope mt-1 mr-2 text-indigo-400"></i>
<span>info@shopease.com</span>
</li>
</ul>
</div>
</div>
<div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-400">
<p>© 2023 ShopEase. All rights reserved.</p>
</div>
</div>
</footer>
<!-- Shopping Cart Sidebar -->
<div id="cart-sidebar" 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="close-cart" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div id="cart-items" class="mb-6">
<!-- Cart items will be dynamically added here -->
<div class="text-center py-8 text-gray-500" id="empty-cart-message">
<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-medium">Subtotal:</span>
<span id="cart-subtotal">$0.00</span>
</div>
<div class="flex justify-between mb-2">
<span class="font-medium">Shipping:</span>
<span>Free</span>
</div>
<div class="flex justify-between text-lg font-bold">
<span>Total:</span>
<span id="cart-total">$0.00</span>
</div>
</div>
<button id="checkout-btn" class="w-full bg-indigo-600 text-white py-3 rounded-lg font-medium hover:bg-indigo-700 transition mb-3">Proceed to Checkout</button>
<button class="w-full border border-indigo-600 text-indigo-600 py-3 rounded-lg font-medium hover:bg-indigo-50 transition">Continue Shopping</button>
</div>
</div>
<!-- Overlay for cart sidebar -->
<div id="overlay" class="fixed inset-0 bg-black bg-opacity-50 z-40 hidden"></div>
<!-- Product Quick View Modal -->
<div id="quick-view-modal" class="fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center hidden">
<div class="bg-white rounded-lg max-w-4xl w-full max-h-[90vh] overflow-y-auto">
<div class="p-6">
<div class="flex justify-between items-start mb-4">
<h3 id="quick-view-title" class="text-2xl font-bold">Product Quick View</h3>
<button id="close-quick-view" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="flex flex-col md:flex-row gap-6">
<div class="md:w-1/2">
<img id="quick-view-image" src="" alt="Product" class="w-full rounded-lg">
</div>
<div class="md:w-1/2">
<div class="flex items-center mb-2">
<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>
<span class="text-gray-500 text-sm">(24 reviews)</span>
</div>
<p id="quick-view-price" class="text-2xl font-bold text-gray-800 mb-4">$99.99</p>
<p id="quick-view-description" class="text-gray-600 mb-6">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<div class="flex items-center mb-6">
<span class="mr-4 font-medium">Quantity:</span>
<div class="flex items-center border border-gray-300 rounded">
<button class="px-3 py-1 text-gray-600 hover:bg-gray-100">-</button>
<span class="px-3 py-1 border-x border-gray-300">1</span>
<button class="px-3 py-1 text-gray-600 hover:bg-gray-100">+</button>
</div>
</div>
<div class="flex space-x-4">
<button class="flex-1 bg-indigo-600 text-white py-3 rounded-lg font-medium hover:bg-indigo-700 transition">
<i class="fas fa-shopping-cart mr-2"></i> Add to Cart
</button>
<button class="flex-1 border border-indigo-600 text-indigo-600 py-3 rounded-lg font-medium hover:bg-indigo-50 transition">
<i class="far fa-heart mr-2"></i> Wishlist
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// Sample product data
const products = [
{
id: 1,
name: "Wireless Headphones",
price: 89.99,
image: "https://images.unsplash.com/photo-1505740420928-5e560c06d30e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80",
description: "Premium wireless headphones with noise cancellation and 30-hour battery life."
},
{
id: 2,
name: "Smart Watch",
price: 199.99,
image: "https://images.unsplash.com/photo-1523275335684-37898b6baf30?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80",
description: "Track your fitness, receive notifications, and more with this stylish smartwatch."
},
{
id: 3,
name: "Bluetooth Speaker",
price: 59.99,
image: "https://images.unsplash.com/photo-1572569511254-d8f925fe2cbb?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80",
description: "Portable Bluetooth speaker with 20W output and 15-hour playtime."
},
{
id: 4,
name: "Laptop Backpack",
price: 49.99,
image: "https://images.unsplash.com/photo-1553062407-98eeb64c6a62?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80",
description: "Durable and stylish backpack with padded laptop compartment."
},
{
id: 5,
name: "Wireless Keyboard",
price: 69.99,
image: "https://images.unsplash.com/photo-1587829741301-dc798b83cc3a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80",
description: "Slim wireless keyboard with quiet keys and long battery life."
},
{
id: 6,
name: "Fitness Tracker",
price: 79.99,
image: "https://images.unsplash.com/photo-1576243345690-4e4b79b63288?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80",
description: "Track your steps, heart rate, and sleep with this comfortable fitness band."
},
{
id: 7,
name: "Portable Charger",
price: 39.99,
image: "https://images.unsplash.com/photo-1598128558393-70ff21433be0?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80",
description: "10000mAh portable charger with fast charging capability."
},
{
id: 8,
name: "Gaming Mouse",
price: 45.99,
image: "https://images.unsplash.com/photo-1527814050087-3793815479db?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80",
description: "High-precision gaming mouse with customizable RGB lighting."
}
];
// Shopping cart data
let cart = [];
// DOM elements
const productsContainer = document.getElementById('products-container');
const cartBtn = document.getElementById('cart-btn');
const cartSidebar = document.getElementById('cart-sidebar');
const closeCartBtn = document.getElementById('close-cart');
const cartItemsContainer = document.getElementById('cart-items');
const cartCount = document.getElementById('cart-count');
const cartSubtotal = document.getElementById('cart-subtotal');
const cartTotal = document.getElementById('cart-total');
const emptyCartMessage = document.getElementById('empty-cart-message');
const overlay = document.getElementById('overlay');
const mobileMenuBtn = document.getElementById('mobile-menu-btn');
const mobileMenu = document.getElementById('mobile-menu');
const searchBtn = document.getElementById('search-btn');
const searchBar = document.getElementById('search-bar');
const quickViewModal = document.getElementById('quick-view-modal');
const closeQuickViewBtn = document.getElementById('close-quick-view');
// Initialize the page
document.addEventListener('DOMContentLoaded', () => {
renderProducts();
updateCartCount();
startCountdown();
// Event listeners
cartBtn.addEventListener('click', toggleCart);
closeCartBtn.addEventListener('click', toggleCart);
overlay.addEventListener('click', toggleCart);
mobileMenuBtn.addEventListener('click', toggleMobileMenu);
searchBtn.addEventListener('click', toggleSearchBar);
closeQuickViewBtn.addEventListener('click', closeQuickView);
});
// Render products to the page
function renderProducts() {
productsContainer.innerHTML = '';
products.forEach(product => {
const productCard = document.createElement('div');
productCard.className = 'bg-white rounded-lg shadow-sm overflow-hidden product-card transition duration-300';
productCard.innerHTML = `
<div class="relative">
<img src="${product.image}" alt="${product.name}" class="w-full h-48 object-cover">
<button class="absolute top-2 right-2 bg-white rounded-full w-8 h-8 flex items-center justify-center shadow-md hover:bg-gray-100">
<i class="far fa-heart text-gray-600"></i>
</button>
</div>
<div class="p-4">
<h3 class="font-semibold text-lg mb-1">${product.name}</h3>
<div class="flex items-center mb-2">
<div class="text-yellow-400 text-sm">
<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>
<span class="text-gray-500 text-sm ml-1">(24)</span>
</div>
<div class="flex justify-between items-center">
<span class="font-bold text-lg">$${product.price.toFixed(2)}</span>
<button class="bg-indigo-600 text-white px-3 py-1 rounded hover:bg-indigo-700 transition add-to-cart" data-id="${product.id}">
<i class="fas fa-shopping-cart mr-1"></i> Add
</button>
</div>
</div>
`;
// Add event listener for quick view
productCard.addEventListener('click', (e) => {
if (!e.target.closest('.add-to-cart') && !e.target.closest('.fa-heart')) {
openQuickView(product);
}
});
productsContainer.appendChild(productCard);
});
// Add event listeners to all "Add to Cart" buttons
document.querySelectorAll('.add-to-cart').forEach(button => {
button.addEventListener('click', (e) => {
e.stopPropagation();
const productId = parseInt(button.getAttribute('data-id'));
addToCart(productId);
});
});
}
// Add product to cart
function addToCart(productId) {
const product = products.find(p => p.id === productId);
// Check if product already exists in cart
const existingItem = cart.find(item => item.id === productId);
if (existingItem) {
existingItem.quantity += 1;
} else {
cart.push({
...product,
quantity: 1
});
}
updateCartCount();
renderCartItems();
// Show cart sidebar if it's hidden
if (cartSidebar.classList.contains('translate-x-full')) {
toggleCart();
}
// Show success message
const notification = document.createElement('div');
notification.className = 'fixed top-4 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg flex items-center';
notification.innerHTML = `
<i class="fas fa-check-circle mr-2"></i>
<span>Added to cart!</span>
`;
document.body.appendChild(notification);
setTimeout(() => {
notification.classList.add('opacity-0', 'transition-opacity', 'duration-300');
setTimeout(() => notification.remove(), 300);
}, 2000);
}
// Remove product from cart
function removeFromCart(productId) {
cart = cart.filter(item => item.id !== productId);
updateCartCount();
renderCartItems();
}
// Update product quantity in cart
function updateQuantity(productId, newQuantity) {
const item = cart.find(item => item.id === productId);
if (item) {
item.quantity = newQuantity;
if (item.quantity <= 0) {
removeFromCart(productId);
} else {
updateCartCount();
renderCartItems();
}
}
}
// Render cart items in sidebar
function renderCartItems() {
cartItemsContainer.innerHTML = '';
if (cart.length === 0) {
emptyCartMessage.classList.remove('hidden');
cartSubtotal.textContent = '$0.00';
cartTotal.textContent = '$0.00';
return;
}
emptyCartMessage.classList.add('hidden');
let subtotal = 0;
cart.forEach(item => {
const cartItem = document.createElement('div');
cartItem.className = 'flex items-center py-4 border-b border-gray-200 cart-item';
cartItem.innerHTML = `
<img src="${item.image}" alt="${item.name}" class="w-16 h-16 object-cover rounded">
<div class="ml-4 flex-grow">
<h4 class="font-medium">${item.name}</h4>
<p class="text-gray-600">$${item.price.toFixed(2)}</p>
</div>
<div class="flex items-center">
<button class="text-gray-500 hover:text-indigo-600 quantity-decrease" data-id="${item.id}">
<i class="fas fa-minus"></i>
</button>
<span class="mx-2 w-8 text-center">${item.quantity}</span>
<button class="text-gray-500 hover:text-indigo-600 quantity-increase" data-id="${item.id}">
<i class="fas fa-plus"></i>
</button>
</div>
<button class="ml-4 text-gray-500 hover:text-red-500 remove-item" data-id="${item.id}">
<i class="fas fa-trash"></i>
</button>
`;
cartItemsContainer.appendChild(cartItem);
subtotal += item.price * item.quantity;
});
// Update totals
cartSubtotal.textContent = `$${subtotal.toFixed(2)}`;
cartTotal.textContent = `$${subtotal.toFixed(2)}`;
// Add event listeners to quantity buttons
document.querySelectorAll('.quantity-decrease').forEach(button => {
button.addEventListener('click', (e) => {
const productId = parseInt(button.getAttribute('data-id'));
const item = cart.find(item => item.id === productId);
if (item) {
updateQuantity(productId, item.quantity - 1);
}
});
});
document.querySelectorAll('.quantity-increase').forEach(button => {
button.addEventListener('click', (e) => {
const productId = parseInt(button.getAttribute('data-id'));
const item = cart.find(item => item.id === productId);
if (item) {
updateQuantity(productId, item.quantity + 1);
}
});
});
document.querySelectorAll('.remove-item').forEach(button => {
button.addEventListener('click', (e) => {
const productId = parseInt(button.getAttribute('data-id'));
removeFromCart(productId);
});
});
}
// Update cart count in header
function updateCartCount() {
const count = cart.reduce((total, item) => total + item.quantity, 0);
cartCount.textContent = count;
}
// Toggle cart sidebar
function toggleCart() {
if (cartSidebar.classList.contains('translate-x-full')) {
cartSidebar.classList.remove('translate-x-full');
overlay.classList.remove('hidden');
document.body.style.overflow = 'hidden';
} else {
cartSidebar.classList.add('translate-x-full');
overlay.classList.add('hidden');
document.body.style.overflow = 'auto';
}
}
// Toggle mobile menu
function toggleMobileMenu() {
mobileMenu.classList.toggle('hidden');
}
// Toggle search bar
function toggleSearchBar() {
searchBar.classList.toggle('hidden');
}
// Open quick view modal
function openQuickView(product) {
document.getElementById('quick-view-title').textContent = product.name;
document.getElementById('quick-view-image').src = product.image;
document.getElementById('quick-view-price').textContent = `$${product.price.toFixed(2)}`;
document.getElementById('quick-view-description').textContent = product.description;
quickViewModal.classList.remove('hidden');
document.body.style.overflow = 'hidden';
}
// Close quick view modal
function closeQuickView() {
quickViewModal.classList.add('hidden');
document.body.style.overflow = 'auto';
}
// Countdown timer for flash sale
function startCountdown() {
let hours = 12;
let minutes = 45;
let seconds = 30;
const hoursElement = document.getElementById('hours');
const minutesElement = document.getElementById('minutes');
const secondsElement = document.getElementById('seconds');
const timer = setInterval(() => {
seconds--;
if (seconds < 0) {
seconds = 59;
minutes--;
}
if (minutes < 0) {
minutes = 59;
hours--;
}
if (hours < 0) {
clearInterval(timer);
return;
}
hoursElement.textContent = hours.toString().padStart(2, '0');
minutesElement.textContent = minutes.toString().padStart(2, '0');
secondsElement.textContent = seconds.toString().padStart(2, '0');
}, 1000);
}
</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=dharnny/test-e-commerce" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |