diff --git a/package-lock.json b/package-lock.json
index af7843d848..3e89598b75 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -21,7 +21,7 @@
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
- "gh-pages": "^6.1.1",
+ "gh-pages": "^6.3.0",
"vite": "^5.2.0"
}
},
@@ -1364,24 +1364,13 @@
}
},
"node_modules/array-union": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
- "integrity": "sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==",
- "dev": true,
- "dependencies": {
- "array-uniq": "^1.0.1"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/array-uniq": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
- "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
+ "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=0.10.0"
+ "node": ">=8"
}
},
"node_modules/array.prototype.findlast": {
@@ -1524,6 +1513,19 @@
"concat-map": "0.0.1"
}
},
+ "node_modules/braces": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fill-range": "^7.1.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/browserslist": {
"version": "4.23.0",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz",
@@ -1634,12 +1636,13 @@
"dev": true
},
"node_modules/commander": {
- "version": "11.1.0",
- "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
- "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
+ "version": "13.1.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz",
+ "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=16"
+ "node": ">=18"
}
},
"node_modules/commondir": {
@@ -1788,6 +1791,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/dir-glob": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
+ "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "path-type": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/doctrine": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
@@ -2336,6 +2352,36 @@
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true
},
+ "node_modules/fast-glob": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
+ "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@nodelib/fs.stat": "^2.0.2",
+ "@nodelib/fs.walk": "^1.2.3",
+ "glob-parent": "^5.1.2",
+ "merge2": "^1.3.0",
+ "micromatch": "^4.0.8"
+ },
+ "engines": {
+ "node": ">=8.6.0"
+ }
+ },
+ "node_modules/fast-glob/node_modules/glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/fast-json-stable-stringify": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
@@ -2395,6 +2441,19 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/fill-range": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "to-regex-range": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/find-cache-dir": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz",
@@ -2573,18 +2632,19 @@
}
},
"node_modules/gh-pages": {
- "version": "6.1.1",
- "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-6.1.1.tgz",
- "integrity": "sha512-upnohfjBwN5hBP9w2dPE7HO5JJTHzSGMV1JrLrHvNuqmjoYHg6TBrCcnEoorjG/e0ejbuvnwyKMdTyM40PEByw==",
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-6.3.0.tgz",
+ "integrity": "sha512-Ot5lU6jK0Eb+sszG8pciXdjMXdBJ5wODvgjR+imihTqsUWF2K6dJ9HST55lgqcs8wWcw6o6wAsUzfcYRhJPXbA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"async": "^3.2.4",
- "commander": "^11.0.0",
+ "commander": "^13.0.0",
"email-addresses": "^5.0.0",
"filenamify": "^4.3.0",
"find-cache-dir": "^3.3.1",
"fs-extra": "^11.1.1",
- "globby": "^6.1.0"
+ "globby": "^11.1.0"
},
"bin": {
"gh-pages": "bin/gh-pages.js",
@@ -2651,19 +2711,24 @@
}
},
"node_modules/globby": {
- "version": "6.1.0",
- "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
- "integrity": "sha512-KVbFv2TQtbzCoxAnfD6JcHZTYCzyliEaaeM/gH8qQdkKr5s0OP9scEgvdcngyk7AVdY6YVW/TJHd+lQ/Df3Daw==",
+ "version": "11.1.0",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
+ "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
"dev": true,
+ "license": "MIT",
"dependencies": {
- "array-union": "^1.0.1",
- "glob": "^7.0.3",
- "object-assign": "^4.0.1",
- "pify": "^2.0.0",
- "pinkie-promise": "^2.0.0"
+ "array-union": "^2.1.0",
+ "dir-glob": "^3.0.1",
+ "fast-glob": "^3.2.9",
+ "ignore": "^5.2.0",
+ "merge2": "^1.4.1",
+ "slash": "^3.0.0"
},
"engines": {
- "node": ">=0.10.0"
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/gopd": {
@@ -3029,6 +3094,16 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.12.0"
+ }
+ },
"node_modules/is-number-object": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz",
@@ -3370,6 +3445,30 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/merge2": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/micromatch": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
+ "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "braces": "^3.0.3",
+ "picomatch": "^2.3.1"
+ },
+ "engines": {
+ "node": ">=8.6"
+ }
+ },
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -3639,40 +3738,33 @@
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true
},
+ "node_modules/path-type": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
+ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/picocolors": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
"dev": true
},
- "node_modules/pify": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
- "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==",
- "dev": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/pinkie": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
- "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==",
+ "node_modules/picomatch": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/pinkie-promise": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
- "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==",
- "dev": true,
- "dependencies": {
- "pinkie": "^2.0.0"
+ "node": ">=8.6"
},
- "engines": {
- "node": ">=0.10.0"
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/pkg-dir": {
@@ -4178,6 +4270,16 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/slash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
+ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/source-map-js": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz",
@@ -4337,6 +4439,19 @@
"node": ">=4"
}
},
+ "node_modules/to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-number": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
"node_modules/trim-repeated": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz",
diff --git a/package.json b/package.json
index b7d4c1d1d4..b8b44735b2 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "shoppingcart",
+ "homepage": "https://mapka-pm.github.io/e-plantShopping",
"private": true,
"version": "0.0.0",
"type": "module",
@@ -7,7 +7,8 @@
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
- "preview": "vite build; vite preview --host"
+ "preview": "vite build && vite preview --host",
+ "deploy": "gh-pages -d dist"
},
"dependencies": {
"@reduxjs/toolkit": "^2.2.3",
@@ -23,7 +24,7 @@
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
- "gh-pages": "^6.1.1",
+ "gh-pages": "^6.3.0",
"vite": "^5.2.0"
}
-}
+}
\ No newline at end of file
diff --git a/src/AboutUs.css b/src/AboutUs.css
index ab682db243..e3f70376d5 100644
--- a/src/AboutUs.css
+++ b/src/AboutUs.css
@@ -1,33 +1,34 @@
.about-us-container {
- width: 1000px;
- /* margin: 0 auto; */
- /* padding: 20px; */
- /* background-color: red; */
- text-align: justify;
- }
-
- .about-us-heading {
- font-size: 32px;
- font-weight: bold;
- color: #333;
- margin-bottom: 20px;
- }
-
- .about-us-description {
- font-size: 18px;
- color: #666;
- margin-bottom: 30px;
- text-align: center;
- }
-
- .about-us-content {
- font-size: 18px;
- margin-bottom: 20px;
- }
- .plant_logo_right{
- text-align: right;
- }
+ max-width: 520px;
+ width: 100%;
+ margin: 0 16px;
+ padding: 8px 0;
+ box-sizing: border-box;
+ text-align: justify;
+}
- .plant_logo_left{
- text-align: left;
- }
\ No newline at end of file
+.about-us-heading {
+ font-size: 32px;
+ font-weight: bold;
+ color: #333;
+ margin-bottom: 20px;
+}
+
+.about-us-description {
+ font-size: 18px;
+ color: #666;
+ margin-bottom: 18px;
+ text-align: center;
+}
+
+.about-us-content {
+ font-size: 18px;
+ margin-bottom: 20px;
+}
+.plant_logo_right {
+ text-align: right;
+}
+
+.plant_logo_left {
+ text-align: left;
+}
diff --git a/src/App.css b/src/App.css
index 88bb5690eb..2706a2c611 100644
--- a/src/App.css
+++ b/src/App.css
@@ -3,14 +3,18 @@
margin: 0;
padding: 0;
box-sizing: border-box;
- overflow: hidden;
}
.landing-page {
position: relative;
- width: 100vw;
- height: 100vh;
+ width: 100%;
+ min-height: 80vh;
background-color: #f8f8f8;
+ overflow: hidden;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 40px 16px;
}
.background-image {
@@ -19,8 +23,8 @@
left: 0;
width: 100%;
height: 100%;
- background-image: url('https://cdn.pixabay.com/photo/2017/07/13/08/59/greenhouse-2499758_1280.jpg');
- background-size: 100% 100%;
+ background-image: url("https://cdn.pixabay.com/photo/2017/07/13/08/59/greenhouse-2499758_1280.jpg");
+ background-size: cover;
background-position: center;
filter: brightness(0.8);
}
@@ -28,23 +32,21 @@
display: flex;
align-items: center;
justify-content: center;
- height: 100vh;
- width: 100vw;
- top: 100px;
+ width: 100%;
+ max-width: 1100px;
backdrop-filter: blur(4px);
- background-color: rgba(0,0,0,0.5);
+ background-color: rgba(0, 0, 0, 0.45);
gap: 20px;
+ border-radius: 12px;
+ padding: 24px;
}
.landing_content {
- margin-top: 430px;
- margin-left: 100px;
- transform: translate(-50%, -50%);
- z-index: 1;
+ margin: 0;
+ z-index: 2;
text-align: center;
- /* background-color: red; */
- width: 400px;
- height: 400px;
+ width: 420px;
+ max-width: 90%;
display: flex;
align-items: center;
flex-direction: column;
@@ -62,16 +64,15 @@
margin-bottom: 10px;
}
-.content p {
- font-size: 25px;
+.content h1 {
+ font-size: 38px;
+ margin-bottom: 8px;
}
-
-.divider {
- width: 50px;
- height: 2px;
- background-color: #4caf50;
- margin: 10px 0;
+.content p {
+ font-size: 18px;
+ line-height: 1.4;
}
+
.get-started-button {
padding: 15px 25px;
@@ -82,7 +83,7 @@
color: white;
cursor: pointer;
transition: background-color 0.3s ease;
- margin-top: 40px;
+ margin-top: 18px;
}
.get-started-button:hover {
diff --git a/src/CartItem.css b/src/CartItem.css
index 66a6a4061f..094f3ade44 100644
--- a/src/CartItem.css
+++ b/src/CartItem.css
@@ -3,75 +3,82 @@
.cart-item {
display: flex;
- border-bottom: 1px solid #ccc;
- padding: 10px 0;
- background-color: white;
- width: 500px;
- gap: 30px;
+ border-bottom: 1px solid #eee;
+ padding: 16px;
+ background-color: #fff;
+ width: 100%;
+ gap: 20px;
+ align-items: center;
}
.cart-item-image {
- width: 200px;
- height: 200px;
- /* object-fit: contain; */
- margin-right: 20px;
+ width: 130px;
+ height: 130px;
+ object-fit: cover;
+ border-radius: 8px;
+ margin-right: 10px;
}
.cart-item-details {
flex-grow: 1;
+ display: flex;
+ flex-direction: column;
}
.cart-item-name {
- font-weight: bold;
- margin-bottom: 5px;
- font-size: 25px;
+ font-weight: 700;
+ margin-bottom: 6px;
+ font-size: 20px;
}
.cart-item-cost {
- margin-bottom: 10px;
- margin-top: 10px;
+ color: #4caf50;
+ margin-bottom: 6px;
+ font-weight: 600;
}
.cart-item-quantity {
display: flex;
align-items: center;
- margin-bottom: 15px;
+ margin: 8px 0;
}
.cart-item-button {
- background-color: #f0f0f0;
- border: 1px solid lightgrey;
+ background-color: #f5f5f5;
+ border: 1px solid #ddd;
color: #333;
- font-size: 18px;
+ font-size: 16px;
cursor: pointer;
- padding: 5px 10px;
- margin: 0 5px;
- border-radius: 5px;
+ padding: 6px 10px;
+ margin: 0 6px;
+ border-radius: 6px;
}
.cart-item-quantity-value {
font-size: 16px;
- font-weight: bold;
+ font-weight: 700;
margin: 0 10px;
}
.cart-item-total {
- font-weight: bold;
+ font-weight: 700;
+ margin-top: 6px;
}
.cart-item-delete {
- background-color: #ff6961;
+ background-color: #ff6b6b;
border: none;
color: #fff;
font-size: 14px;
cursor: pointer;
- padding: 10px 15px;
+ padding: 8px 12px;
margin-top: 10px;
- border-radius: 10px;
+ border-radius: 8px;
+ align-self: flex-start;
}
.cart-item-delete:hover {
- background-color: #cc0000;
+ background-color: #e33a3a;
}
/* .cart-item-button-dec{
background-color: red;
@@ -101,143 +108,74 @@
margin-top: 10px; /* Add margin top for spacing */
}
}
-.cart-item {
- display: flex;
- border-bottom: 1px solid #ccc;
- padding: 10px 0;
- background-color: white;
- width: 500px;
- gap: 30px;
+/* duplicate block removed */
+/* .cart-item-button-dec{
+ background-color: red;
}
-
+ .cart-item-button-inc{
+ background-color: green;
+ } */
+@media (max-width: 768px) {
+ .cart-item {
+ flex-direction: column; /* Change flex direction to stack items vertically */
+ align-items: flex-start; /* Align items to the start of the container */
+ width: 100%; /* Set width to full width */
+ }
+
.cart-item-image {
- width: 200px;
- height: 200px;
- /* object-fit: contain; */
- margin-right: 20px;
+ width: 100%; /* Set image width to full width */
+ height: auto; /* Allow image height to adjust proportionally */
+ margin-right: 0; /* Remove margin */
+ margin-bottom: 10px; /* Add margin bottom for spacing */
}
-
+
.cart-item-details {
- flex-grow: 1;
- }
-
- .cart-item-name {
- font-weight: bold;
- margin-bottom: 5px;
- font-size: 25px;
- }
-
- .cart-item-cost {
- margin-bottom: 10px;
- margin-top: 10px;
+ width: 100%; /* Set details width to full width */
}
-
+
.cart-item-quantity {
- display: flex;
- align-items: center;
- margin-bottom: 15px;
- }
-
- .cart-item-button {
- background-color: #f0f0f0;
- border: 1px solid lightgrey;
- color: #333;
- font-size: 18px;
- cursor: pointer;
- padding: 5px 10px;
- margin: 0 5px;
- border-radius: 5px;
- }
-
- .cart-item-quantity-value {
- font-size: 16px;
- font-weight: bold;
- margin: 0 10px;
- }
-
- .cart-item-total {
- font-weight: bold;
- }
-
- .cart-item-delete {
- background-color: #ff6961;
- border: none;
- color: #fff;
- font-size: 14px;
- cursor: pointer;
- padding: 10px 15px;
- margin-top: 10px;
- border-radius: 10px;
- }
-
- .cart-item-delete:hover {
- background-color: #cc0000;
- }
- /* .cart-item-button-dec{
- background-color: red;
- }
- .cart-item-button-inc{
- background-color: green;
- } */
- @media (max-width: 768px) {
- .cart-item {
- flex-direction: column; /* Change flex direction to stack items vertically */
- align-items: flex-start; /* Align items to the start of the container */
- width: 100%; /* Set width to full width */
- }
-
- .cart-item-image {
- width: 100%; /* Set image width to full width */
- height: auto; /* Allow image height to adjust proportionally */
- margin-right: 0; /* Remove margin */
- margin-bottom: 10px; /* Add margin bottom for spacing */
- }
-
- .cart-item-details {
- width: 100%; /* Set details width to full width */
- }
-
- .cart-item-quantity {
- margin-top: 10px; /* Add margin top for spacing */
- }
+ margin-top: 10px; /* Add margin top for spacing */
}
-
-
- .cart-container{
- /* text-align: center; */
- display: flex;
- align-items: center;
- flex-direction: column;
- justify-content: center;
- gap: 20px;
- margin-top: 20px;
- }
- .total_cart_amount{
- font-size: 20px;
- font-weight: 900;
- }
-.continue_shopping_btn{
- margin-top: -50px;
-}
- @media (max-width: 768px) {
- .cart-container {
- padding: 10px; /* Reduce padding */
- }
-
- .total_cart_amount {
- font-size: 18px; /* Reduce font size */
- }
+}
+
+.cart-container {
+ display: flex;
+ align-items: stretch;
+ flex-direction: column;
+ justify-content: flex-start;
+ gap: 18px;
+ margin: 20px auto;
+ max-width: 1000px;
+ padding: 12px;
+}
+.total_cart_amount {
+ font-size: 20px;
+ font-weight: 900;
+}
+.continue_shopping_btn {
+ margin-top: 10px;
+ display: flex;
+ gap: 12px;
+ align-items: center;
+}
+@media (max-width: 768px) {
+ .cart-container {
+ padding: 10px; /* Reduce padding */
}
- .get-started-button1 {
- padding: 15px 75px;
- font-size: 23px;
- border: none;
- border-radius: 5px;
- background-color: #4caf50;
- color: white;
- cursor: pointer;
- transition: background-color 0.3s ease;
- margin-top: 40px;
+ .total_cart_amount {
+ font-size: 18px; /* Reduce font size */
}
-
\ No newline at end of file
+}
+
+.get-started-button1 {
+ padding: 12px 30px;
+ font-size: 16px;
+ border: none;
+ border-radius: 6px;
+ background-color: #4caf50;
+ color: white;
+ cursor: pointer;
+ transition: background-color 0.18s ease;
+ margin-top: 0;
+}
diff --git a/src/CartItem.jsx b/src/CartItem.jsx
index e06317433f..5ba2a9521d 100644
--- a/src/CartItem.jsx
+++ b/src/CartItem.jsx
@@ -1,68 +1,112 @@
-import React from 'react';
-import { useSelector, useDispatch } from 'react-redux';
-import { removeItem, updateQuantity } from './CartSlice';
-import './CartItem.css';
+import React from "react";
+import { useSelector, useDispatch } from "react-redux";
+import { removeItem, updateQuantity } from "./CartSlice";
+import "./CartItem.css";
const CartItem = ({ onContinueShopping }) => {
- const cart = useSelector(state => state.cart.items);
+ const cart = useSelector((state) => state.cart.items);
const dispatch = useDispatch();
// Calculate total amount for all products in the cart
const calculateTotalAmount = () => {
-
+ if (!cart || cart.length === 0) return 0;
+ return cart
+ .reduce((sum, item) => {
+ const price = parseFloat(String(item.cost).replace("$", "")) || 0;
+ return sum + price * (item.quantity || 0);
+ }, 0)
+ .toFixed(2);
};
const handleContinueShopping = (e) => {
-
+ e && e.preventDefault();
+ onContinueShopping && onContinueShopping();
};
-
-
const handleIncrement = (item) => {
+ dispatch(updateQuantity({ name: item.name, delta: 1 }));
};
const handleDecrement = (item) => {
-
+ dispatch(updateQuantity({ name: item.name, delta: -1 }));
};
const handleRemove = (item) => {
+ dispatch(removeItem(item.name));
};
// Calculate total cost based on quantity for an item
const calculateTotalCost = (item) => {
+ const price = parseFloat(String(item.cost).replace("$", "")) || 0;
+ return (price * (item.quantity || 0)).toFixed(2);
};
return (
-
Total Cart Amount: ${calculateTotalAmount()}
+
+ Total Cart Amount: ${calculateTotalAmount()}
+
+
+ Total Items: {cart.reduce((s, i) => s + (i.quantity || 0), 0)}
+
- {cart.map(item => (
+ {cart.map((item) => (
{item.name}
{item.cost}
-
- {item.quantity}
-
+
+
+ {item.quantity}
+
+
+
+
+ Total: ${calculateTotalCost(item)}
-
Total: ${calculateTotalCost(item)}
-
+
))}
-
+
-
+
-
+
);
};
export default CartItem;
-
-
diff --git a/src/CartSlice.jsx b/src/CartSlice.jsx
index 32b8761ed0..62cf297087 100644
--- a/src/CartSlice.jsx
+++ b/src/CartSlice.jsx
@@ -1,19 +1,33 @@
-import { createSlice } from '@reduxjs/toolkit';
+import { createSlice } from "@reduxjs/toolkit";
-export const CartSlice = createSlice({
- name: 'cart',
+const CartSlice = createSlice({
+ name: "cart",
initialState: {
- items: [], // Initialize items as an empty array
+ items: [],
},
reducers: {
addItem: (state, action) => {
-
+ const item = action.payload;
+ const existing = state.items.find((i) => i.name === item.name);
+ if (existing) {
+ existing.quantity += 1;
+ } else {
+ state.items.push({ ...item, quantity: 1 });
+ }
},
removeItem: (state, action) => {
+ const name = action.payload;
+ state.items = state.items.filter((i) => i.name !== name);
},
updateQuantity: (state, action) => {
-
-
+ const { name, delta } = action.payload;
+ const existing = state.items.find((i) => i.name === name);
+ if (existing) {
+ existing.quantity += delta;
+ if (existing.quantity <= 0) {
+ state.items = state.items.filter((i) => i.name !== name);
+ }
+ }
},
},
});
diff --git a/src/ProductList.css b/src/ProductList.css
index 52f9c7a84f..339c3adc53 100644
--- a/src/ProductList.css
+++ b/src/ProductList.css
@@ -1,252 +1,257 @@
/* Reset some default styles */
-body, h1, ul {
- margin: 0;
- padding: 0;
+body,
+h1,
+ul {
+ margin: 0;
+ padding: 0;
}
/* Set a background color */
body {
- font-family: Arial, sans-serif;
- background-color: #f0f0f0;
+ font-family: Arial, sans-serif;
+ background-color: #f0f0f0;
}
/* Navbar */
.navbar {
- background-color: #4CAF50;
- color: #fff!important;
- padding: 15px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- font-size: 20px;
+ background-color: #4caf50;
+ color: #fff !important;
+ padding: 15px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ font-size: 20px;
}
.navbar .ul {
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 1100px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ width: 1100px;
}
.navbar li {
- margin-right: 30px;
+ margin-right: 30px;
}
.navbar .ul div a {
- color: white;
- font-size: 30px;
- text-decoration: none;
-
+ color: white;
+ font-size: 30px;
+ text-decoration: none;
}
/* Product Grid */
.product-grid {
- display:flex;
- flex-direction: column;
- width: 100vw;
- align-items: center;
- justify-content: center;
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ align-items: center;
+ justify-content: flex-start;
}
+
.product-list {
- display: flex;
- flex-wrap: wrap;
- gap: 50px;
- /* background-color: pink; */
- /* justify-content: space-between; */
- padding: 20px;
- width: 100%;
- align-items: center;
- justify-content: center;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 30px;
+ padding: 20px;
+ width: 100%;
+ align-items: flex-start;
+ justify-content: center;
}
/* Product Card */
+
.product-card {
- flex: 0 0 calc(33.33% - 20px); /* Adjust width for 3 cards per row with 20px gap */
- max-width: calc(26.33% - 20px); /* Adjust max-width for 3 cards per row with 20px gap */
- margin-bottom: 20px;
- padding: 20px;
- background-color: #fff;
- border: 1px solid #ccc;
- border-radius: 5px;
- text-align: center;
- position: relative;
-
- gap: 20px;
+ width: 220px;
+ margin-bottom: 20px;
+ padding: 14px;
+ background-color: #fff;
+ border: 1px solid #e6e6e6;
+ border-radius: 10px;
+ text-align: center;
+ position: relative;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
+ transition: transform 0.18s ease, box-shadow 0.18s ease;
}
/* Pseudo-classes - Hover effect on product button */
.product-card:hover {
- transform: scale(1.05);
- transition: transform 0.3s ease-in-out;
- z-index: 1;
+ transform: translateY(-6px);
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
+ z-index: 2;
}
.product-title {
- font-weight: bold;
- margin-bottom: 10px;
+ font-weight: bold;
+ margin-bottom: 10px;
}
.product-price {
- color: #e74c3c;
- font-size: 1.2rem;
- margin-bottom: 10px;
+ color: #e74c3c;
+ font-size: 1.2rem;
+ margin-bottom: 10px;
}
.product-image {
- max-width: 100%;
- height: 200px; /* Adjust height for better consistency */
+ max-width: 100%;
+ height: 140px; /* Adjusted for compact cards */
+ object-fit: cover;
+ border-radius: 6px;
+ margin-bottom: 10px;
}
-.product-button {
- background-color: #e74c3c;
- color: #fff;
- border: none;
- padding: 10px 20px;
- cursor: pointer;
- transition: background-color 0.3s ease-in-out;
- margin-top: 10px;
+.product-card button,
+.product-card .get-started-button {
+ background-color: #4caf50;
+ color: #fff;
+ border: none;
+ padding: 10px 12px;
+ cursor: pointer;
+ transition: background-color 0.18s ease;
+ margin-top: 12px;
+ border-radius: 6px;
+ font-weight: 600;
}
-.product-button:hover {
- background-color: #c0392b;
+.product-card button[disabled],
+.product-card .get-started-button[disabled] {
+ background-color: #9aa9a0;
+ cursor: default;
+ opacity: 0.85;
}
/* Pseudo-elements - Sale badge */
.product-card::before {
- content: "SALE";
- background-color: #e74c3c;
- color: #fff;
- position: absolute;
- top: 0;
- right: 0;
- padding: 5px 10px;
- border-radius: 0 0 0 5px;
-}
-.tag_home_link{
- display: flex;
- /* background-color: red; */
- flex-direction: column;
- align-items: center;
- justify-content: center;
- margin-left: 50px;
- color: white;
- text-decoration: none;
- font-size: 20px;
-}
-.tag_home_link h3{
- font-size: 30px;
-}
-.tag a{
- text-decoration: none;
+ /* subtle decorative badge placeholder - hidden by default */
+ content: "";
+}
+.tag_home_link {
+ display: flex;
+ /* background-color: red; */
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ margin-left: 50px;
+ color: white;
+ text-decoration: none;
+ font-size: 20px;
+}
+.tag_home_link h3 {
+ font-size: 30px;
+}
+.tag a {
+ text-decoration: none;
}
.tag {
- width: 400px;
- display: flex;
- align-items: center;
- justify-content: center;
+ width: 400px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
}
.tag img {
- height: 70px;
- width: 70px;
- border-radius: 70%;
-
+ height: 70px;
+ width: 70px;
+ border-radius: 70%;
}
.luxury {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 650px;
- font-size: 19px;
-}
-.cart{
- color: white;
- display: flex;
-}
-.cart_quantity_count{
- margin-top: 16px;
- /* background-color: red; */
- margin-left: 27px;
- position: absolute;
- font-size: 29px;
-
-}
-.plantname_heading{
- display: flex;
- align-items: center;
- justify-content: center;
- /* background-color: yellow; */
-}
-.plant_heading{
- width: 400px;
- text-align: center;
- margin: 20px;
- border: 1px solid rgb(5, 4, 4);
- border-left: none;
- border-right: none;
-
-
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 650px;
+ font-size: 19px;
+}
+.cart {
+ color: white;
+ display: flex;
+}
+.cart_quantity_count {
+ margin-top: 16px;
+ /* background-color: red; */
+ margin-left: 27px;
+ position: absolute;
+ font-size: 29px;
+}
+.plantname_heading {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ /* background-color: yellow; */
+}
+.plant_heading {
+ width: 400px;
+ text-align: center;
+ margin: 20px;
+ border: 1px solid rgb(5, 4, 4);
+ border-left: none;
+ border-right: none;
}
/* Add Media Query for responsiveness */
@media (max-width: 768px) {
- .product-card {
- flex: 1 1 calc(50% - 20px); /* Adjust width for 2 cards per row with 20px gap on smaller screens */
- max-width: calc(50% - 20px); /* Adjust max-width for 2 cards per row with 20px gap on smaller screens */
- }
+ .product-card {
+ flex: 1 1 calc(50% - 20px); /* Adjust width for 2 cards per row with 20px gap on smaller screens */
+ max-width: calc(
+ 50% - 20px
+ ); /* Adjust max-width for 2 cards per row with 20px gap on smaller screens */
+ }
}
/* ProductList.css */
.product-button {
- background-color: #4CAF50; /* Green */
- border: none;
- color: white;
- padding: 10px 20px;
- text-align: center;
- text-decoration: none;
- display: inline-block;
- font-size: 16px;
- margin: 4px 2px;
- transition-duration: 0.4s;
- cursor: pointer;
+ background-color: #4caf50; /* Green */
+ border: none;
+ color: white;
+ padding: 10px 20px;
+ text-align: center;
+ text-decoration: none;
+ display: inline-block;
+ font-size: 16px;
+ margin: 4px 2px;
+ transition-duration: 0.4s;
+ cursor: pointer;
+}
+
+.product-button:hover {
+ background-color: #45a049;
+}
+
+.product-button.added-to-cart {
+ background-color: grey; /* Grey when product is added */
+}
+@media (max-width: 1200px) {
+ .product-card {
+ flex: 1 1 calc(33.33% - 20px); /* Adjust width for 3 cards per row with 20px gap on medium screens */
+ max-width: calc(
+ 33.33% - 20px
+ ); /* Adjust max-width for 3 cards per row with 20px gap on medium screens */
}
-
- .product-button:hover {
- background-color: #45a049;
+}
+
+@media (max-width: 768px) {
+ .product-card {
+ flex: 1 1 calc(50% - 20px); /* Adjust width for 2 cards per row with 20px gap on small screens */
+ max-width: calc(
+ 50% - 20px
+ ); /* Adjust max-width for 2 cards per row with 20px gap on small screens */
}
-
- .product-button.added-to-cart {
- background-color: grey; /* Grey when product is added */
+ .navbar {
+ flex-direction: column; /* Change flex direction to stack items vertically */
+ align-items: center; /* Align items to the center of the container */
}
- @media (max-width: 1200px) {
- .product-card {
- flex: 1 1 calc(33.33% - 20px); /* Adjust width for 3 cards per row with 20px gap on medium screens */
- max-width: calc(33.33% - 20px); /* Adjust max-width for 3 cards per row with 20px gap on medium screens */
- }
+
+ .tag {
+ margin-bottom: 20px; /* Add margin bottom for spacing */
+ text-align: center; /* Align text to the center */
+ }
+
+ .ul {
+ display: flex; /* Set display to flex */
+ flex-direction: column; /* Change flex direction to stack items vertically */
+ gap: 10px; /* Add gap between items */
}
-
- @media (max-width: 768px) {
- .product-card {
- flex: 1 1 calc(50% - 20px); /* Adjust width for 2 cards per row with 20px gap on small screens */
- max-width: calc(50% - 20px); /* Adjust max-width for 2 cards per row with 20px gap on small screens */
- }
- .navbar {
- flex-direction: column; /* Change flex direction to stack items vertically */
- align-items: center; /* Align items to the center of the container */
- }
-
- .tag {
- margin-bottom: 20px; /* Add margin bottom for spacing */
- text-align: center; /* Align text to the center */
- }
-
- .ul {
- display: flex; /* Set display to flex */
- flex-direction: column; /* Change flex direction to stack items vertically */
- gap: 10px; /* Add gap between items */
- }
-
- .ul div {
- text-align: center; /* Align text to the center */
- }
- }
\ No newline at end of file
+
+ .ul div {
+ text-align: center; /* Align text to the center */
+ }
+}
diff --git a/src/ProductList.jsx b/src/ProductList.jsx
index 7682c04fc4..04bec75621 100644
--- a/src/ProductList.jsx
+++ b/src/ProductList.jsx
@@ -1,287 +1,230 @@
-import React, { useState, useEffect } from 'react';
-import './ProductList.css'
-import CartItem from './CartItem';
+import React, { useState, useEffect } from "react";
+import "./ProductList.css";
+import CartItem from "./CartItem";
+import { useDispatch, useSelector } from "react-redux";
+import { addItem } from "./CartSlice";
+
function ProductList({ onHomeClick }) {
- const [showCart, setShowCart] = useState(false);
- const [showPlants, setShowPlants] = useState(false); // State to control the visibility of the About Us page
+ const dispatch = useDispatch();
+ const cartItems = useSelector((state) => state.cart.items || []);
+ const cartCount = cartItems.reduce((s, i) => s + (i.quantity || 0), 0);
- const plantsArray = [
- {
- category: "Air Purifying Plants",
- plants: [
- {
- name: "Snake Plant",
- image: "https://cdn.pixabay.com/photo/2021/01/22/06/04/snake-plant-5939187_1280.jpg",
- description: "Produces oxygen at night, improving air quality.",
- cost: "$15"
- },
- {
- name: "Spider Plant",
- image: "https://cdn.pixabay.com/photo/2018/07/11/06/47/chlorophytum-3530413_1280.jpg",
- description: "Filters formaldehyde and xylene from the air.",
- cost: "$12"
- },
- {
- name: "Peace Lily",
- image: "https://cdn.pixabay.com/photo/2019/06/12/14/14/peace-lilies-4269365_1280.jpg",
- description: "Removes mold spores and purifies the air.",
- cost: "$18"
- },
- {
- name: "Boston Fern",
- image: "https://cdn.pixabay.com/photo/2020/04/30/19/52/boston-fern-5114414_1280.jpg",
- description: "Adds humidity to the air and removes toxins.",
- cost: "$20"
- },
- {
- name: "Rubber Plant",
- image: "https://cdn.pixabay.com/photo/2020/02/15/11/49/flower-4850729_1280.jpg",
- description: "Easy to care for and effective at removing toxins.",
- cost: "$17"
- },
- {
- name: "Aloe Vera",
- image: "https://cdn.pixabay.com/photo/2018/04/02/07/42/leaf-3283175_1280.jpg",
- description: "Purifies the air and has healing properties for skin.",
- cost: "$14"
- }
- ]
- },
- {
- category: "Aromatic Fragrant Plants",
- plants: [
- {
- name: "Lavender",
- image: "https://images.unsplash.com/photo-1611909023032-2d6b3134ecba?q=80&w=1074&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
- description: "Calming scent, used in aromatherapy.",
- cost: "$20"
- },
- {
- name: "Jasmine",
- image: "https://images.unsplash.com/photo-1592729645009-b96d1e63d14b?q=80&w=1170&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
- description: "Sweet fragrance, promotes relaxation.",
- cost: "$18"
- },
- {
- name: "Rosemary",
- image: "https://cdn.pixabay.com/photo/2019/10/11/07/12/rosemary-4541241_1280.jpg",
- description: "Invigorating scent, often used in cooking.",
- cost: "$15"
- },
- {
- name: "Mint",
- image: "https://cdn.pixabay.com/photo/2016/01/07/18/16/mint-1126282_1280.jpg",
- description: "Refreshing aroma, used in teas and cooking.",
- cost: "$12"
- },
- {
- name: "Lemon Balm",
- image: "https://cdn.pixabay.com/photo/2019/09/16/07/41/balm-4480134_1280.jpg",
- description: "Citrusy scent, relieves stress and promotes sleep.",
- cost: "$14"
- },
- {
- name: "Hyacinth",
- image: "https://cdn.pixabay.com/photo/2019/04/07/20/20/hyacinth-4110726_1280.jpg",
- description: "Hyacinth is a beautiful flowering plant known for its fragrant.",
- cost: "$22"
- }
- ]
- },
- {
- category: "Insect Repellent Plants",
- plants: [
- {
- name: "oregano",
- image: "https://cdn.pixabay.com/photo/2015/05/30/21/20/oregano-790702_1280.jpg",
- description: "The oregano plants contains compounds that can deter certain insects.",
- cost: "$10"
- },
- {
- name: "Marigold",
- image: "https://cdn.pixabay.com/photo/2022/02/22/05/45/marigold-7028063_1280.jpg",
- description: "Natural insect repellent, also adds color to the garden.",
- cost: "$8"
- },
- {
- name: "Geraniums",
- image: "https://cdn.pixabay.com/photo/2012/04/26/21/51/flowerpot-43270_1280.jpg",
- description: "Known for their insect-repelling properties while adding a pleasant scent.",
- cost: "$20"
- },
- {
- name: "Basil",
- image: "https://cdn.pixabay.com/photo/2016/07/24/20/48/tulsi-1539181_1280.jpg",
- description: "Repels flies and mosquitoes, also used in cooking.",
- cost: "$9"
- },
- {
- name: "Lavender",
- image: "https://images.unsplash.com/photo-1611909023032-2d6b3134ecba?q=80&w=1074&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
- description: "Calming scent, used in aromatherapy.",
- cost: "$20"
- },
- {
- name: "Catnip",
- image: "https://cdn.pixabay.com/photo/2015/07/02/21/55/cat-829681_1280.jpg",
- description: "Repels mosquitoes and attracts cats.",
- cost: "$13"
- }
- ]
- },
- {
- category: "Medicinal Plants",
- plants: [
- {
- name: "Aloe Vera",
- image: "https://cdn.pixabay.com/photo/2018/04/02/07/42/leaf-3283175_1280.jpg",
- description: "Soothing gel used for skin ailments.",
- cost: "$14"
- },
- {
- name: "Echinacea",
- image: "https://cdn.pixabay.com/photo/2014/12/05/03/53/echinacea-557477_1280.jpg",
- description: "Boosts immune system, helps fight colds.",
- cost: "$16"
- },
- {
- name: "Peppermint",
- image: "https://cdn.pixabay.com/photo/2017/07/12/12/23/peppermint-2496773_1280.jpg",
- description: "Relieves digestive issues and headaches.",
- cost: "$13"
- },
- {
- name: "Lemon Balm",
- image: "https://cdn.pixabay.com/photo/2019/09/16/07/41/balm-4480134_1280.jpg",
- description: "Calms nerves and promotes relaxation.",
- cost: "$14"
- },
- {
- name: "Chamomile",
- image: "https://cdn.pixabay.com/photo/2016/08/19/19/48/flowers-1606041_1280.jpg",
- description: "Soothes anxiety and promotes sleep.",
- cost: "$15"
- },
- {
- name: "Calendula",
- image: "https://cdn.pixabay.com/photo/2019/07/15/18/28/flowers-4340127_1280.jpg",
- description: "Heals wounds and soothes skin irritations.",
- cost: "$12"
- }
- ]
- },
- {
- category: "Low Maintenance Plants",
- plants: [
- {
- name: "ZZ Plant",
- image: "https://images.unsplash.com/photo-1632207691143-643e2a9a9361?q=80&w=464&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
- description: "Thrives in low light and requires minimal watering.",
- cost: "$25"
- },
- {
- name: "Pothos",
- image: "https://cdn.pixabay.com/photo/2018/11/15/10/32/plants-3816945_1280.jpg",
- description: "Tolerates neglect and can grow in various conditions.",
- cost: "$10"
- },
- {
- name: "Snake Plant",
- image: "https://cdn.pixabay.com/photo/2021/01/22/06/04/snake-plant-5939187_1280.jpg",
- description: "Needs infrequent watering and is resilient to most pests.",
- cost: "$15"
- },
- {
- name: "Cast Iron Plant",
- image: "https://cdn.pixabay.com/photo/2017/02/16/18/04/cast-iron-plant-2072008_1280.jpg",
- description: "Hardy plant that tolerates low light and neglect.",
- cost: "$20"
- },
- {
- name: "Succulents",
- image: "https://cdn.pixabay.com/photo/2016/11/21/16/05/cacti-1846147_1280.jpg",
- description: "Drought-tolerant plants with unique shapes and colors.",
- cost: "$18"
- },
- {
- name: "Aglaonema",
- image: "https://cdn.pixabay.com/photo/2014/10/10/04/27/aglaonema-482915_1280.jpg",
- description: "Requires minimal care and adds color to indoor spaces.",
- cost: "$22"
- }
- ]
- }
- ];
- const styleObj = {
- backgroundColor: '#4CAF50',
- color: '#fff!important',
- padding: '15px',
- display: 'flex',
- justifyContent: 'space-between',
- alignIems: 'center',
- fontSize: '20px',
- }
- const styleObjUl = {
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'center',
- width: '1100px',
- }
- const styleA = {
- color: 'white',
- fontSize: '30px',
- textDecoration: 'none',
- }
+ const [showCart, setShowCart] = useState(false);
+ const [disabledItems, setDisabledItems] = useState({});
- const handleHomeClick = (e) => {
- e.preventDefault();
- onHomeClick();
- };
+ // Define six unique products across at least three categories
+ const products = [
+ {
+ id: 1,
+ name: "Snake Plant",
+ image:
+ "https://cdn.pixabay.com/photo/2021/01/22/06/04/snake-plant-5939187_1280.jpg",
+ cost: "$15",
+ category: "Air Purifying",
+ },
+ {
+ id: 2,
+ name: "Peace Lily",
+ image:
+ "https://cdn.pixabay.com/photo/2019/06/12/14/14/peace-lilies-4269365_1280.jpg",
+ cost: "$18",
+ category: "Air Purifying",
+ },
+ {
+ id: 3,
+ name: "Lavender",
+ image:
+ "https://images.unsplash.com/photo-1611909023032-2d6b3134ecba?q=80&w=1074&auto=format&fit=crop&ixlib=rb-4.0.3",
+ cost: "$20",
+ category: "Aromatic",
+ },
+ {
+ id: 4,
+ name: "Jasmine",
+ image:
+ "https://images.unsplash.com/photo-1592729645009-b96d1e63d14b?q=80&w=1170&auto=format&fit=crop&ixlib=rb-4.0.3",
+ cost: "$18",
+ category: "Aromatic",
+ },
+ {
+ id: 5,
+ name: "Pothos",
+ image:
+ "https://cdn.pixabay.com/photo/2018/11/15/10/32/plants-3816945_1280.jpg",
+ cost: "$10",
+ category: "Low Maintenance",
+ },
+ {
+ id: 6,
+ name: "ZZ Plant",
+ image:
+ "https://images.unsplash.com/photo-1632207691143-643e2a9a9361?q=80&w=464&auto=format&fit=crop&ixlib=rb-4.0.3",
+ cost: "$25",
+ category: "Low Maintenance",
+ },
+ ];
- const handleCartClick = (e) => {
- e.preventDefault();
- setShowCart(true); // Set showCart to true when cart icon is clicked
- };
- const handlePlantsClick = (e) => {
- e.preventDefault();
- setShowPlants(true); // Set showAboutUs to true when "About Us" link is clicked
- setShowCart(false); // Hide the cart when navigating to About Us
- };
+ // Group by category
+ const grouped = products.reduce((acc, p) => {
+ acc[p.category] = acc[p.category] || [];
+ acc[p.category].push(p);
+ return acc;
+ }, {});
- const handleContinueShopping = (e) => {
- e.preventDefault();
- setShowCart(false);
- };
- return (
-
-
-
-
+ useEffect(() => {
+ // Initialize disabled state from items already in cart
+ const map = {};
+ cartItems.forEach((i) => {
+ map[i.name] = true;
+ });
+ setDisabledItems(map);
+ }, [cartItems]);
-
-
-
- {!showCart ? (
-
+ const styleObj = {
+ backgroundColor: "#4CAF50",
+ color: "#fff!important",
+ padding: "15px",
+ display: "flex",
+ justifyContent: "space-between",
+ alignIems: "center",
+ fontSize: "20px",
+ };
+ const styleObjUl = {
+ display: "flex",
+ justifyContent: "space-between",
+ alignItems: "center",
+ width: "1100px",
+ };
+ const styleA = {
+ color: "white",
+ fontSize: "30px",
+ textDecoration: "none",
+ };
+
+ const handleHomeClick = (e) => {
+ e && e.preventDefault();
+ onHomeClick();
+ };
+
+ const handleCartClick = (e) => {
+ e && e.preventDefault();
+ setShowCart(true);
+ };
+
+ const handlePlantsClick = (e) => {
+ e && e.preventDefault();
+ setShowCart(false);
+ };
+ const handleContinueShopping = (e) => {
+ e && e.preventDefault();
+ setShowCart(false);
+ };
-
- ) : (
-
- )}
+ const handleAddToCart = (product) => {
+ dispatch(addItem(product));
+ setDisabledItems((prev) => ({ ...prev, [product.name]: true }));
+ };
+
+ return (
+
+
+
+ {!showCart ? (
+
+ {Object.keys(grouped).map((category) => (
+
+
{category}
+
+ {grouped[category].map((p) => (
+
+

+
{p.name}
+
{p.cost}
+
+
+ ))}
+
+
+ ))}
- );
+ ) : (
+
+ )}
+
+ );
}
export default ProductList;
diff --git a/vite.config.js b/vite.config.js
index 4d190ae430..02593f5af3 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -3,6 +3,6 @@ import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
- base: "/shoppingreact",
+ base: "/e-plantShopping/",
plugins: [react()],
})