Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	Initial commit: Basic project structure and page templates created. (#21)
Browse files- Initial commit: Basic project structure and page templates created. (9a30761ec0096bc18efca6dd55b45e31d813b09d)
Co-authored-by: smolSWE Bot <smolSWE@users.noreply.huggingface.co>
- .gitignore +3 -0
- cart.html +39 -21
- checkout.html +44 -37
- confirmation.html +23 -16
- index.html +23 -15
- product.html +28 -23
- script.js +0 -151
- style.css +0 -11
- tailwind.config.js +1 -8
    	
        .gitignore
    CHANGED
    
    | @@ -0,0 +1,3 @@ | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            node_modules/
         | 
| 2 | 
            +
            .DS_Store
         | 
| 3 | 
            +
            .env
         | 
    	
        cart.html
    CHANGED
    
    | @@ -1,39 +1,57 @@ | |
| 1 | 
            -
             | 
| 2 | 
             
            <!DOCTYPE html>
         | 
| 3 | 
             
            <html lang="en">
         | 
| 4 | 
             
            <head>
         | 
| 5 | 
             
                <meta charset="UTF-8">
         | 
| 6 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 7 | 
            -
                <title>Shopping Cart</title>
         | 
| 8 | 
            -
                <link href=" | 
|  | |
| 9 | 
             
            </head>
         | 
| 10 | 
            -
            <body | 
| 11 | 
            -
                < | 
| 12 | 
            -
                    <div class="container mx-auto">
         | 
| 13 | 
            -
                        < | 
| 14 | 
            -
                        < | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 15 | 
             
                    </div>
         | 
| 16 | 
            -
                </ | 
| 17 |  | 
| 18 | 
             
                <main class="container mx-auto mt-8">
         | 
| 19 | 
            -
                    < | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 23 | 
             
                    </div>
         | 
| 24 |  | 
| 25 | 
            -
                    <div class="mt- | 
| 26 | 
            -
                        < | 
| 27 | 
            -
                        < | 
| 28 | 
            -
             | 
| 29 | 
            -
                        </ | 
|  | |
| 30 | 
             
                    </div>
         | 
| 31 | 
             
                </main>
         | 
| 32 |  | 
| 33 | 
            -
                <footer class="bg-gray- | 
| 34 | 
            -
                    <p>© 2024 Amazon  | 
| 35 | 
             
                </footer>
         | 
| 36 |  | 
| 37 | 
             
                <script src="script.js"></script>
         | 
| 38 | 
             
            </body>
         | 
| 39 | 
            -
            </html>
         | 
|  | |
|  | |
| 1 | 
             
            <!DOCTYPE html>
         | 
| 2 | 
             
            <html lang="en">
         | 
| 3 | 
             
            <head>
         | 
| 4 | 
             
                <meta charset="UTF-8">
         | 
| 5 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 6 | 
            +
                <title>Shopping Cart - Amazon Clone</title>
         | 
| 7 | 
            +
                <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
         | 
| 8 | 
            +
                <link rel="stylesheet" href="style.css">
         | 
| 9 | 
             
            </head>
         | 
| 10 | 
            +
            <body>
         | 
| 11 | 
            +
                <nav class="bg-gray-800 p-4 text-white">
         | 
| 12 | 
            +
                    <div class="container mx-auto flex items-center justify-between">
         | 
| 13 | 
            +
                        <a href="/" class="text-2xl font-bold">Amazon</a>
         | 
| 14 | 
            +
                        <div class="flex items-center">
         | 
| 15 | 
            +
                            <input type="text" placeholder="Search" class="bg-gray-700 text-white px-4 py-2 rounded-md mr-2">
         | 
| 16 | 
            +
                            <button class="bg-yellow-500 text-gray-800 px-4 py-2 rounded-md hover:bg-yellow-400">Search</button>
         | 
| 17 | 
            +
                        </div>
         | 
| 18 | 
            +
                        <div>
         | 
| 19 | 
            +
                            <a href="/cart.html" class="hover:text-yellow-500">Cart</a>
         | 
| 20 | 
            +
                        </div>
         | 
| 21 | 
             
                    </div>
         | 
| 22 | 
            +
                </nav>
         | 
| 23 |  | 
| 24 | 
             
                <main class="container mx-auto mt-8">
         | 
| 25 | 
            +
                    <h1>Shopping Cart</h1>
         | 
| 26 | 
            +
                    <div class="grid grid-cols-1 gap-4">
         | 
| 27 | 
            +
                        <div class="flex items-center border border-gray-300 rounded-md p-4">
         | 
| 28 | 
            +
                            <img src="https://via.placeholder.com/100" alt="Product Image" class="w-24 h-24 mr-4">
         | 
| 29 | 
            +
                            <div>
         | 
| 30 | 
            +
                                <h2 class="text-lg font-bold">Product Title</h2>
         | 
| 31 | 
            +
                                <p class="text-gray-600">$99.99</p>
         | 
| 32 | 
            +
                                <div class="flex items-center mt-2">
         | 
| 33 | 
            +
                                    <button class="bg-gray-200 px-2 py-1 rounded-md">-</button>
         | 
| 34 | 
            +
                                    <input type="number" value="1" class="w-16 text-center border border-gray-300 rounded-md mx-2">
         | 
| 35 | 
            +
                                    <button class="bg-gray-200 px-2 py-1 rounded-md">+</button>
         | 
| 36 | 
            +
                                    <button class="text-red-500 hover:text-red-700 ml-4">Remove</button>
         | 
| 37 | 
            +
                                </div>
         | 
| 38 | 
            +
                            </div>
         | 
| 39 | 
            +
                        </div>
         | 
| 40 | 
             
                    </div>
         | 
| 41 |  | 
| 42 | 
            +
                    <div class="mt-8">
         | 
| 43 | 
            +
                        <h2 class="text-xl font-bold">Order Summary</h2>
         | 
| 44 | 
            +
                        <p>Subtotal: $99.99</p>
         | 
| 45 | 
            +
                        <p>Shipping: $5.00</p>
         | 
| 46 | 
            +
                        <p class="font-bold">Total: $104.99</p>
         | 
| 47 | 
            +
                        <button class="bg-yellow-500 text-gray-800 px-4 py-2 rounded-md hover:bg-yellow-400">Proceed to Checkout</button>
         | 
| 48 | 
             
                    </div>
         | 
| 49 | 
             
                </main>
         | 
| 50 |  | 
| 51 | 
            +
                <footer class="bg-gray-800 p-4 text-white text-center mt-8">
         | 
| 52 | 
            +
                    <p>© 2024 Amazon Clone</p>
         | 
| 53 | 
             
                </footer>
         | 
| 54 |  | 
| 55 | 
             
                <script src="script.js"></script>
         | 
| 56 | 
             
            </body>
         | 
| 57 | 
            +
            </html>
         | 
    	
        checkout.html
    CHANGED
    
    | @@ -1,53 +1,60 @@ | |
| 1 | 
            -
             | 
| 2 | 
             
            <!DOCTYPE html>
         | 
| 3 | 
             
            <html lang="en">
         | 
| 4 | 
             
            <head>
         | 
| 5 | 
             
                <meta charset="UTF-8">
         | 
| 6 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 7 | 
            -
                <title>Checkout</title>
         | 
| 8 | 
            -
                <link href=" | 
|  | |
| 9 | 
             
            </head>
         | 
| 10 | 
            -
            <body | 
| 11 | 
            -
                < | 
| 12 | 
            -
                    <div class="container mx-auto">
         | 
| 13 | 
            -
                        < | 
| 14 | 
            -
             | 
| 15 | 
            -
                            < | 
|  | |
|  | |
|  | |
|  | |
| 16 | 
             
                        </div>
         | 
| 17 | 
             
                    </div>
         | 
| 18 | 
            -
                </ | 
| 19 |  | 
| 20 | 
             
                <main class="container mx-auto mt-8">
         | 
| 21 | 
            -
                    < | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
                            < | 
| 26 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 27 | 
             
                        </div>
         | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
                            < | 
| 31 | 
            -
                            < | 
|  | |
|  | |
| 32 | 
             
                        </div>
         | 
| 33 | 
            -
             | 
| 34 | 
            -
                        <button type="submit" class="bg-amazon-yellow hover:bg-yellow-500 text-black font-bold py-2 px-4 rounded">
         | 
| 35 | 
            -
                            Place Order
         | 
| 36 | 
            -
                        </button>
         | 
| 37 | 
            -
                    </form>
         | 
| 38 | 
             
                </main>
         | 
| 39 |  | 
| 40 | 
            -
                <footer class="bg-gray- | 
| 41 | 
            -
                    <p>© 2024 Amazon  | 
| 42 | 
             
                </footer>
         | 
| 43 | 
            -
            </body>
         | 
| 44 | 
            -
            </html>
         | 
| 45 |  | 
| 46 | 
            -
            <script>
         | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
                    // Redirect to the confirmation page
         | 
| 51 | 
            -
                    window.location.href = 'confirmation.html';
         | 
| 52 | 
            -
                });
         | 
| 53 | 
            -
            </script>
         | 
|  | |
|  | |
| 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>Checkout - Amazon Clone</title>
         | 
| 7 | 
            +
                <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
         | 
| 8 | 
            +
                <link rel="stylesheet" href="style.css">
         | 
| 9 | 
             
            </head>
         | 
| 10 | 
            +
            <body>
         | 
| 11 | 
            +
                <nav class="bg-gray-800 p-4 text-white">
         | 
| 12 | 
            +
                    <div class="container mx-auto flex items-center justify-between">
         | 
| 13 | 
            +
                        <a href="/" class="text-2xl font-bold">Amazon</a>
         | 
| 14 | 
            +
                        <div class="flex items-center">
         | 
| 15 | 
            +
                            <input type="text" placeholder="Search" class="bg-gray-700 text-white px-4 py-2 rounded-md mr-2">
         | 
| 16 | 
            +
                            <button class="bg-yellow-500 text-gray-800 px-4 py-2 rounded-md hover:bg-yellow-400">Search</button>
         | 
| 17 | 
            +
                        </div>
         | 
| 18 | 
            +
                        <div>
         | 
| 19 | 
            +
                            <a href="/cart.html" class="hover:text-yellow-500">Cart</a>
         | 
| 20 | 
             
                        </div>
         | 
| 21 | 
             
                    </div>
         | 
| 22 | 
            +
                </nav>
         | 
| 23 |  | 
| 24 | 
             
                <main class="container mx-auto mt-8">
         | 
| 25 | 
            +
                    <h1>Checkout</h1>
         | 
| 26 | 
            +
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
         | 
| 27 | 
            +
                        <div>
         | 
| 28 | 
            +
                            <h2 class="text-xl font-bold">Shipping Information</h2>
         | 
| 29 | 
            +
                            <form>
         | 
| 30 | 
            +
                                <div class="mb-4">
         | 
| 31 | 
            +
                                    <label for="name" class="block text-gray-700 text-sm font-bold mb-2">Name:</label>
         | 
| 32 | 
            +
                                    <input type="text" id="name" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
         | 
| 33 | 
            +
                                </div>
         | 
| 34 | 
            +
                                <div class="mb-4">
         | 
| 35 | 
            +
                                    <label for="address" class="block text-gray-700 text-sm font-bold mb-2">Address:</label>
         | 
| 36 | 
            +
                                    <input type="text" id="address" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
         | 
| 37 | 
            +
                                </div>
         | 
| 38 | 
            +
                                <div class="mb-4">
         | 
| 39 | 
            +
                                    <label for="payment" class="block text-gray-700 text-sm font-bold mb-2">Payment Information:</label>
         | 
| 40 | 
            +
                                    <input type="text" id="payment" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
         | 
| 41 | 
            +
                                </div>
         | 
| 42 | 
            +
                            </form>
         | 
| 43 | 
             
                        </div>
         | 
| 44 | 
            +
                        <div>
         | 
| 45 | 
            +
                            <h2 class="text-xl font-bold">Order Summary</h2>
         | 
| 46 | 
            +
                            <p>Subtotal: $99.99</p>
         | 
| 47 | 
            +
                            <p>Shipping: $5.00</p>
         | 
| 48 | 
            +
                            <p class="font-bold">Total: $104.99</p>
         | 
| 49 | 
            +
                            <button class="bg-yellow-500 text-gray-800 px-4 py-2 rounded-md hover:bg-yellow-400">Place Order</button>
         | 
| 50 | 
             
                        </div>
         | 
| 51 | 
            +
                    </div>
         | 
|  | |
|  | |
|  | |
|  | |
| 52 | 
             
                </main>
         | 
| 53 |  | 
| 54 | 
            +
                <footer class="bg-gray-800 p-4 text-white text-center mt-8">
         | 
| 55 | 
            +
                    <p>© 2024 Amazon Clone</p>
         | 
| 56 | 
             
                </footer>
         | 
|  | |
|  | |
| 57 |  | 
| 58 | 
            +
                <script src="script.js"></script>
         | 
| 59 | 
            +
            </body>
         | 
| 60 | 
            +
            </html>
         | 
|  | |
|  | |
|  | |
|  | |
|  | 
    	
        confirmation.html
    CHANGED
    
    | @@ -1,30 +1,37 @@ | |
| 1 | 
            -
             | 
| 2 | 
             
            <!DOCTYPE html>
         | 
| 3 | 
             
            <html lang="en">
         | 
| 4 | 
             
            <head>
         | 
| 5 | 
             
                <meta charset="UTF-8">
         | 
| 6 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 7 | 
            -
                <title>Order Confirmation</title>
         | 
| 8 | 
            -
                <link href=" | 
|  | |
| 9 | 
             
            </head>
         | 
| 10 | 
            -
            <body | 
| 11 | 
            -
                < | 
| 12 | 
            -
                    <div class="container mx-auto">
         | 
| 13 | 
            -
                        < | 
| 14 | 
            -
             | 
| 15 | 
            -
                            < | 
|  | |
|  | |
|  | |
|  | |
| 16 | 
             
                        </div>
         | 
| 17 | 
             
                    </div>
         | 
| 18 | 
            -
                </ | 
| 19 |  | 
| 20 | 
             
                <main class="container mx-auto mt-8">
         | 
| 21 | 
            -
                    < | 
| 22 | 
            -
             | 
| 23 | 
            -
                    <p | 
|  | |
| 24 | 
             
                </main>
         | 
| 25 |  | 
| 26 | 
            -
                <footer class="bg-gray- | 
| 27 | 
            -
                    <p>© 2024 Amazon  | 
| 28 | 
             
                </footer>
         | 
|  | |
|  | |
| 29 | 
             
            </body>
         | 
| 30 | 
            -
            </html>
         | 
|  | |
|  | |
| 1 | 
             
            <!DOCTYPE html>
         | 
| 2 | 
             
            <html lang="en">
         | 
| 3 | 
             
            <head>
         | 
| 4 | 
             
                <meta charset="UTF-8">
         | 
| 5 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 6 | 
            +
                <title>Order Confirmation - Amazon Clone</title>
         | 
| 7 | 
            +
                <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
         | 
| 8 | 
            +
                <link rel="stylesheet" href="style.css">
         | 
| 9 | 
             
            </head>
         | 
| 10 | 
            +
            <body>
         | 
| 11 | 
            +
                <nav class="bg-gray-800 p-4 text-white">
         | 
| 12 | 
            +
                    <div class="container mx-auto flex items-center justify-between">
         | 
| 13 | 
            +
                        <a href="/" class="text-2xl font-bold">Amazon</a>
         | 
| 14 | 
            +
                        <div class="flex items-center">
         | 
| 15 | 
            +
                            <input type="text" placeholder="Search" class="bg-gray-700 text-white px-4 py-2 rounded-md mr-2">
         | 
| 16 | 
            +
                            <button class="bg-yellow-500 text-gray-800 px-4 py-2 rounded-md hover:bg-yellow-400">Search</button>
         | 
| 17 | 
            +
                        </div>
         | 
| 18 | 
            +
                        <div>
         | 
| 19 | 
            +
                            <a href="/cart.html" class="hover:text-yellow-500">Cart</a>
         | 
| 20 | 
             
                        </div>
         | 
| 21 | 
             
                    </div>
         | 
| 22 | 
            +
                </nav>
         | 
| 23 |  | 
| 24 | 
             
                <main class="container mx-auto mt-8">
         | 
| 25 | 
            +
                    <h1>Order Confirmation</h1>
         | 
| 26 | 
            +
                    <p>Thank you for your order!</p>
         | 
| 27 | 
            +
                    <p>Your order has been placed and will be shipped soon.</p>
         | 
| 28 | 
            +
                    <p>Order ID: #1234567890</p>
         | 
| 29 | 
             
                </main>
         | 
| 30 |  | 
| 31 | 
            +
                <footer class="bg-gray-800 p-4 text-white text-center mt-8">
         | 
| 32 | 
            +
                    <p>© 2024 Amazon Clone</p>
         | 
| 33 | 
             
                </footer>
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                <script src="script.js"></script>
         | 
| 36 | 
             
            </body>
         | 
| 37 | 
            +
            </html>
         | 
    	
        index.html
    CHANGED
    
    | @@ -3,26 +3,34 @@ | |
| 3 | 
             
            <head>
         | 
| 4 | 
             
                <meta charset="UTF-8">
         | 
| 5 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 6 | 
            -
                <title>Amazon  | 
| 7 | 
            -
                <link href=" | 
|  | |
| 8 | 
             
            </head>
         | 
| 9 | 
             
            <body>
         | 
| 10 | 
            -
                < | 
| 11 | 
            -
                    <div class="container mx-auto  | 
| 12 | 
            -
                        < | 
| 13 | 
            -
             | 
| 14 | 
            -
                            < | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
|  | |
| 18 | 
             
                        </div>
         | 
| 19 | 
             
                    </div>
         | 
| 20 | 
            -
                </ | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
                     | 
|  | |
| 25 | 
             
                </main>
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
| 26 | 
             
                <script src="script.js"></script>
         | 
| 27 | 
             
            </body>
         | 
| 28 | 
             
            </html>
         | 
|  | |
| 3 | 
             
            <head>
         | 
| 4 | 
             
                <meta charset="UTF-8">
         | 
| 5 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 6 | 
            +
                <title>Amazon Clone</title>
         | 
| 7 | 
            +
                <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
         | 
| 8 | 
            +
                <link rel="stylesheet" href="style.css">
         | 
| 9 | 
             
            </head>
         | 
| 10 | 
             
            <body>
         | 
| 11 | 
            +
                <nav class="bg-gray-800 p-4 text-white">
         | 
| 12 | 
            +
                    <div class="container mx-auto flex items-center justify-between">
         | 
| 13 | 
            +
                        <a href="/" class="text-2xl font-bold">Amazon</a>
         | 
| 14 | 
            +
                        <div class="flex items-center">
         | 
| 15 | 
            +
                            <input type="text" placeholder="Search" class="bg-gray-700 text-white px-4 py-2 rounded-md mr-2">
         | 
| 16 | 
            +
                            <button class="bg-yellow-500 text-gray-800 px-4 py-2 rounded-md hover:bg-yellow-400">Search</button>
         | 
| 17 | 
            +
                        </div>
         | 
| 18 | 
            +
                        <div>
         | 
| 19 | 
            +
                            <a href="/cart.html" class="hover:text-yellow-500">Cart</a>
         | 
| 20 | 
             
                        </div>
         | 
| 21 | 
             
                    </div>
         | 
| 22 | 
            +
                </nav>
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                <main class="container mx-auto mt-8">
         | 
| 25 | 
            +
                    <h1>Welcome to Amazon</h1>
         | 
| 26 | 
            +
                    <div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4">
         | 
| 27 | 
            +
                        </div>
         | 
| 28 | 
             
                </main>
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                <footer class="bg-gray-800 p-4 text-white text-center mt-8">
         | 
| 31 | 
            +
                    <p>© 2024 Amazon Clone</p>
         | 
| 32 | 
            +
                </footer>
         | 
| 33 | 
            +
             | 
| 34 | 
             
                <script src="script.js"></script>
         | 
| 35 | 
             
            </body>
         | 
| 36 | 
             
            </html>
         | 
    	
        product.html
    CHANGED
    
    | @@ -1,39 +1,44 @@ | |
| 1 | 
            -
             | 
| 2 | 
             
            <!DOCTYPE html>
         | 
| 3 | 
             
            <html lang="en">
         | 
| 4 | 
             
            <head>
         | 
| 5 | 
             
                <meta charset="UTF-8">
         | 
| 6 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 7 | 
            -
                <title>Product Details</title>
         | 
| 8 | 
            -
                <link href=" | 
|  | |
| 9 | 
             
            </head>
         | 
| 10 | 
            -
            <body | 
| 11 | 
            -
                < | 
| 12 | 
            -
                    <div class="container mx-auto">
         | 
| 13 | 
            -
                        < | 
| 14 | 
            -
                        < | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 15 | 
             
                    </div>
         | 
| 16 | 
            -
                </ | 
| 17 |  | 
| 18 | 
             
                <main class="container mx-auto mt-8">
         | 
| 19 | 
            -
                    <div class="grid grid-cols-1 md:grid-cols-2 gap- | 
| 20 | 
            -
                        <div | 
| 21 | 
            -
                            <img src="https:// | 
| 22 | 
             
                        </div>
         | 
| 23 | 
            -
                        <div | 
| 24 | 
            -
                            < | 
| 25 | 
            -
                            <p class="text-gray- | 
| 26 | 
            -
             | 
| 27 | 
            -
                            </ | 
| 28 | 
            -
                            <button id="add-to-cart-btn" class="bg-amazon-yellow hover:bg-yellow-500 text-black font-bold py-2 px-4 rounded">
         | 
| 29 | 
            -
                                Add to Cart
         | 
| 30 | 
            -
                            </button>
         | 
| 31 | 
             
                        </div>
         | 
| 32 | 
             
                    </div>
         | 
| 33 | 
             
                </main>
         | 
| 34 |  | 
| 35 | 
            -
                <footer class="bg-gray- | 
| 36 | 
            -
                    <p>© 2024 Amazon  | 
| 37 | 
             
                </footer>
         | 
|  | |
|  | |
| 38 | 
             
            </body>
         | 
| 39 | 
            -
            </html>
         | 
|  | |
|  | |
| 1 | 
             
            <!DOCTYPE html>
         | 
| 2 | 
             
            <html lang="en">
         | 
| 3 | 
             
            <head>
         | 
| 4 | 
             
                <meta charset="UTF-8">
         | 
| 5 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 6 | 
            +
                <title>Product Details - Amazon Clone</title>
         | 
| 7 | 
            +
                <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
         | 
| 8 | 
            +
                <link rel="stylesheet" href="style.css">
         | 
| 9 | 
             
            </head>
         | 
| 10 | 
            +
            <body>
         | 
| 11 | 
            +
                <nav class="bg-gray-800 p-4 text-white">
         | 
| 12 | 
            +
                    <div class="container mx-auto flex items-center justify-between">
         | 
| 13 | 
            +
                        <a href="/" class="text-2xl font-bold">Amazon</a>
         | 
| 14 | 
            +
                        <div class="flex items-center">
         | 
| 15 | 
            +
                            <input type="text" placeholder="Search" class="bg-gray-700 text-white px-4 py-2 rounded-md mr-2">
         | 
| 16 | 
            +
                            <button class="bg-yellow-500 text-gray-800 px-4 py-2 rounded-md hover:bg-yellow-400">Search</button>
         | 
| 17 | 
            +
                        </div>
         | 
| 18 | 
            +
                        <div>
         | 
| 19 | 
            +
                            <a href="/cart.html" class="hover:text-yellow-500">Cart</a>
         | 
| 20 | 
            +
                        </div>
         | 
| 21 | 
             
                    </div>
         | 
| 22 | 
            +
                </nav>
         | 
| 23 |  | 
| 24 | 
             
                <main class="container mx-auto mt-8">
         | 
| 25 | 
            +
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
         | 
| 26 | 
            +
                        <div>
         | 
| 27 | 
            +
                            <img src="https://via.placeholder.com/400" alt="Product Image" class="w-full rounded-md">
         | 
| 28 | 
             
                        </div>
         | 
| 29 | 
            +
                        <div>
         | 
| 30 | 
            +
                            <h1 class="text-2xl font-bold">Product Title</h1>
         | 
| 31 | 
            +
                            <p class="text-gray-600">Product Description</p>
         | 
| 32 | 
            +
                            <p class="text-xl font-semibold">$99.99</p>
         | 
| 33 | 
            +
                            <button class="bg-yellow-500 text-gray-800 px-4 py-2 rounded-md hover:bg-yellow-400">Add to Cart</button>
         | 
|  | |
|  | |
|  | |
| 34 | 
             
                        </div>
         | 
| 35 | 
             
                    </div>
         | 
| 36 | 
             
                </main>
         | 
| 37 |  | 
| 38 | 
            +
                <footer class="bg-gray-800 p-4 text-white text-center mt-8">
         | 
| 39 | 
            +
                    <p>© 2024 Amazon Clone</p>
         | 
| 40 | 
             
                </footer>
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                <script src="script.js"></script>
         | 
| 43 | 
             
            </body>
         | 
| 44 | 
            +
            </html>
         | 
    	
        script.js
    CHANGED
    
    | @@ -1,151 +0,0 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            // script.js
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            // Function to add a product to the cart
         | 
| 5 | 
            -
            function addToCart(productName, productPrice) {
         | 
| 6 | 
            -
                let cart = JSON.parse(localStorage.getItem('cart')) || [];
         | 
| 7 | 
            -
                let existingProduct = cart.find(item => item.name === productName);
         | 
| 8 | 
            -
             | 
| 9 | 
            -
                if (existingProduct) {
         | 
| 10 | 
            -
                    existingProduct.quantity += 1;
         | 
| 11 | 
            -
                } else {
         | 
| 12 | 
            -
                    cart.push({
         | 
| 13 | 
            -
                        name: productName,
         | 
| 14 | 
            -
                        price: productPrice,
         | 
| 15 | 
            -
                        quantity: 1
         | 
| 16 | 
            -
                    });
         | 
| 17 | 
            -
                }
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                localStorage.setItem('cart', JSON.stringify(cart));
         | 
| 20 | 
            -
                updateCartTotal();
         | 
| 21 | 
            -
            }
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            // Function to display cart items on cart.html
         | 
| 24 | 
            -
            function displayCartItems() {
         | 
| 25 | 
            -
                let cart = JSON.parse(localStorage.getItem('cart')) || [];
         | 
| 26 | 
            -
                let cartItemsContainer = document.getElementById('cart-items');
         | 
| 27 | 
            -
                let cartTotalElement = document.getElementById('cart-total');
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                if (cartItemsContainer) {
         | 
| 30 | 
            -
                    cartItemsContainer.innerHTML = ''; // Clear existing items
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                    if (cart.length === 0) {
         | 
| 33 | 
            -
                        cartItemsContainer.innerHTML = '<p>Your cart is empty.</p>';
         | 
| 34 | 
            -
                        cartTotalElement.textContent = '0.00';
         | 
| 35 | 
            -
                        return;
         | 
| 36 | 
            -
                    }
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                    let total = 0;
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                    cart.forEach(item => {
         | 
| 41 | 
            -
                        let itemElement = document.createElement('div');
         | 
| 42 | 
            -
                        itemElement.classList.add('cart-item', 'mb-4', 'p-4', 'border', 'border-gray-300', 'rounded-lg');
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                        itemElement.innerHTML = `
         | 
| 45 | 
            -
                            <h4 class="text-lg font-semibold">${item.name}</h4>
         | 
| 46 | 
            -
                            <p>Price: $${item.price.toFixed(2)}</p>
         | 
| 47 | 
            -
                            <div class="flex items-center">
         | 
| 48 | 
            -
                                <label for="quantity-${item.name}" class="mr-2">Quantity:</label>
         | 
| 49 | 
            -
                                <input type="number" id="quantity-${item.name}" name="quantity-${item.name}" value="${item.quantity}" min="1" class="w-20 px-2 py-1 border border-gray-300 rounded">
         | 
| 50 | 
            -
                                <button class="remove-item-btn bg-red-500 hover:bg-red-700 text-white font-bold py-1 px-2 rounded ml-2" data-product="${item.name}">Remove</button>
         | 
| 51 | 
            -
                            </div>
         | 
| 52 | 
            -
                        `;
         | 
| 53 | 
            -
             | 
| 54 | 
            -
                        cartItemsContainer.appendChild(itemElement);
         | 
| 55 | 
            -
                        total += item.price * item.quantity;
         | 
| 56 | 
            -
                    });
         | 
| 57 | 
            -
             | 
| 58 | 
            -
                    cartTotalElement.textContent = total.toFixed(2);
         | 
| 59 | 
            -
             | 
| 60 | 
            -
                    // Add event listeners to quantity inputs and remove buttons
         | 
| 61 | 
            -
                    let quantityInputs = cartItemsContainer.querySelectorAll('input[type="number"]');
         | 
| 62 | 
            -
                    quantityInputs.forEach(input => {
         | 
| 63 | 
            -
                        input.addEventListener('change', updateQuantity);
         | 
| 64 | 
            -
                    });
         | 
| 65 | 
            -
             | 
| 66 | 
            -
                    let removeButtons = cartItemsContainer.querySelectorAll('.remove-item-btn');
         | 
| 67 | 
            -
                    removeButtons.forEach(button => {
         | 
| 68 | 
            -
                        button.addEventListener('click', removeItem);
         | 
| 69 | 
            -
                    });
         | 
| 70 | 
            -
                }
         | 
| 71 | 
            -
            }
         | 
| 72 | 
            -
             | 
| 73 | 
            -
            // Function to update cart item quantity
         | 
| 74 | 
            -
            function updateQuantity(event) {
         | 
| 75 | 
            -
                let productName = event.target.id.replace('quantity-', '');
         | 
| 76 | 
            -
                let newQuantity = parseInt(event.target.value);
         | 
| 77 | 
            -
             | 
| 78 | 
            -
                if (newQuantity > 0) {
         | 
| 79 | 
            -
                    let cart = JSON.parse(localStorage.getItem('cart')) || [];
         | 
| 80 | 
            -
                    let itemToUpdate = cart.find(item => item.name === productName);
         | 
| 81 | 
            -
             | 
| 82 | 
            -
                    if (itemToUpdate) {
         | 
| 83 | 
            -
                        itemToUpdate.quantity = newQuantity;
         | 
| 84 | 
            -
                        localStorage.setItem('cart', JSON.stringify(cart));
         | 
| 85 | 
            -
                        updateCartTotal();
         | 
| 86 | 
            -
                        displayCartItems(); // Re-render the cart items to reflect the updated quantity
         | 
| 87 | 
            -
                    }
         | 
| 88 | 
            -
                }
         | 
| 89 | 
            -
            }
         | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
            // Function to remove item from cart
         | 
| 93 | 
            -
            function removeItem(event) {
         | 
| 94 | 
            -
                let productName = event.target.dataset.product;
         | 
| 95 | 
            -
                let cart = JSON.parse(localStorage.getItem('cart')) || [];
         | 
| 96 | 
            -
                let updatedCart = cart.filter(item => item.name !== productName);
         | 
| 97 | 
            -
             | 
| 98 | 
            -
                localStorage.setItem('cart', JSON.stringify(updatedCart));
         | 
| 99 | 
            -
                updateCartTotal();
         | 
| 100 | 
            -
                displayCartItems(); // Re-render the cart items after removing the item
         | 
| 101 | 
            -
            }
         | 
| 102 | 
            -
             | 
| 103 | 
            -
            // Function to calculate and update the cart total
         | 
| 104 | 
            -
            function updateCartTotal() {
         | 
| 105 | 
            -
                let cart = JSON.parse(localStorage.getItem('cart')) || [];
         | 
| 106 | 
            -
                let total = 0;
         | 
| 107 | 
            -
             | 
| 108 | 
            -
                cart.forEach(item => {
         | 
| 109 | 
            -
                    total += item.price * item.quantity;
         | 
| 110 | 
            -
                });
         | 
| 111 | 
            -
             | 
| 112 | 
            -
                let cartTotalElement = document.getElementById('cart-total');
         | 
| 113 | 
            -
                if (cartTotalElement) {
         | 
| 114 | 
            -
                    cartTotalElement.textContent = total.toFixed(2);
         | 
| 115 | 
            -
                }
         | 
| 116 | 
            -
            }
         | 
| 117 | 
            -
             | 
| 118 | 
            -
            // Add to cart functionality to product.html (example)
         | 
| 119 | 
            -
            //document.addEventListener('DOMContentLoaded', () => {
         | 
| 120 | 
            -
            //    const addToCartButton = document.querySelector('#add-to-cart-btn'); // Assuming you have an add to cart button with this ID
         | 
| 121 | 
            -
            //    if (addToCartButton) {
         | 
| 122 | 
            -
            //        addToCartButton.addEventListener('click', () => {
         | 
| 123 | 
            -
            //            const productName = 'Product Name'; // Replace with the actual product name
         | 
| 124 | 
            -
            //            const productPrice = 20.00; // Replace with the actual product price
         | 
| 125 | 
            -
            //            addToCart(productName, productPrice);
         | 
| 126 | 
            -
            //        });
         | 
| 127 | 
            -
            //    }
         | 
| 128 | 
            -
            //});
         | 
| 129 | 
            -
             | 
| 130 | 
            -
            // Call displayCartItems() when cart.html loads
         | 
| 131 | 
            -
            if (document.body.id === 'cart-page') {
         | 
| 132 | 
            -
                displayCartItems();
         | 
| 133 | 
            -
            }
         | 
| 134 | 
            -
             | 
| 135 | 
            -
            // Update cart total on page load
         | 
| 136 | 
            -
            document.addEventListener('DOMContentLoaded', updateCartTotal);
         | 
| 137 | 
            -
             | 
| 138 | 
            -
             | 
| 139 | 
            -
            // Add to cart functionality to product.html
         | 
| 140 | 
            -
            document.addEventListener('DOMContentLoaded', () => {
         | 
| 141 | 
            -
                // Set the ID of the body
         | 
| 142 | 
            -
                document.body.id = 'product-page';
         | 
| 143 | 
            -
                const addToCartButton = document.querySelector('#add-to-cart-btn'); // Assuming you have an add to cart button with this ID
         | 
| 144 | 
            -
                if (addToCartButton) {
         | 
| 145 | 
            -
                    addToCartButton.addEventListener('click', () => {
         | 
| 146 | 
            -
                        const productName = 'Product Name'; // Replace with the actual product name
         | 
| 147 | 
            -
                        const productPrice = 20.00; // Replace with the actual product price
         | 
| 148 | 
            -
                        addToCart(productName, productPrice);
         | 
| 149 | 
            -
                    });
         | 
| 150 | 
            -
                }
         | 
| 151 | 
            -
            });
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
    	
        style.css
    CHANGED
    
    | @@ -1,11 +0,0 @@ | |
| 1 | 
            -
            @tailwind base;
         | 
| 2 | 
            -
            @tailwind components;
         | 
| 3 | 
            -
            @tailwind utilities;
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            .bg-amazon-blue {
         | 
| 6 | 
            -
                background-color: #232F3E;
         | 
| 7 | 
            -
            }
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            .bg-amazon-orange {
         | 
| 10 | 
            -
                background-color: #FF9900;
         | 
| 11 | 
            -
            }
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
    	
        tailwind.config.js
    CHANGED
    
    | @@ -2,14 +2,7 @@ | |
| 2 | 
             
            module.exports = {
         | 
| 3 | 
             
              content: ["./*.{html,js}"],
         | 
| 4 | 
             
              theme: {
         | 
| 5 | 
            -
                extend: {
         | 
| 6 | 
            -
                  colors: {
         | 
| 7 | 
            -
                    amazon: {
         | 
| 8 | 
            -
                      blue: '#232F3E',
         | 
| 9 | 
            -
                      orange: '#FF9900',
         | 
| 10 | 
            -
                    }
         | 
| 11 | 
            -
                  }
         | 
| 12 | 
            -
                },
         | 
| 13 | 
             
              },
         | 
| 14 | 
             
              plugins: [],
         | 
| 15 | 
             
            }
         | 
|  | |
| 2 | 
             
            module.exports = {
         | 
| 3 | 
             
              content: ["./*.{html,js}"],
         | 
| 4 | 
             
              theme: {
         | 
| 5 | 
            +
                extend: {},
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 6 | 
             
              },
         | 
| 7 | 
             
              plugins: [],
         | 
| 8 | 
             
            }
         | 

