diff --git a/package-lock.json b/package-lock.json
index 60164f1..f8f91f2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -54,7 +54,6 @@
"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@babel/code-frame": "^7.29.7",
"@babel/generator": "^7.29.7",
@@ -1325,7 +1324,6 @@
"integrity": "sha512-vfEqpXTvwT91yhmwdfouStN2hSKwTvyRs8qpLfADyrq/kxDw0hZM7Wk9Ug1FELj8hIby+S/+kQCSRFF32nv2Qw==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@types/prop-types": "*",
"csstype": "^3.2.2"
@@ -1375,7 +1373,6 @@
"integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
"dev": true,
"license": "MIT",
- "peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -1658,7 +1655,6 @@
}
],
"license": "MIT",
- "peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.10.44",
"caniuse-lite": "^1.0.30001806",
@@ -2258,7 +2254,6 @@
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
@@ -3994,7 +3989,6 @@
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
"license": "MIT",
- "peer": true,
"dependencies": {
"loose-envify": "^1.1.0"
},
@@ -4007,7 +4001,6 @@
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
"license": "MIT",
- "peer": true,
"dependencies": {
"loose-envify": "^1.1.0",
"scheduler": "^0.23.2"
@@ -4827,7 +4820,6 @@
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
"dev": true,
"license": "MIT",
- "peer": true,
"dependencies": {
"esbuild": "^0.21.3",
"postcss": "^8.4.43",
diff --git a/src/App.css b/src/App.css
index 73a237a..b1cd72f 100644
--- a/src/App.css
+++ b/src/App.css
@@ -22,7 +22,6 @@
border-radius: 4px;
}
-/* Dark Mode Toggle */
.dark-toggle {
padding: 3px;
width: fit-content;
@@ -74,7 +73,6 @@ html[data-theme="dark"] .welcome p {
color: #ddd;
}
-/* Error Page */
.error-container {
display: flex;
gap: 10px;
@@ -105,8 +103,7 @@ html[data-theme="dark"] .welcome p {
text-transform: uppercase;
font-weight: bolder;
color: #8e8dd3;
- font-family:
- "Lucida Sans", "Lucida Sans Regular", "Lucida Grande",
+ font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande",
"Lucida Sans Unicode", Geneva, Verdana, sans-serif;
}
@@ -130,7 +127,6 @@ html[data-theme="dark"] .welcome p {
opacity: 0.8;
}
-/* Loading Spinner */
.loading-container {
display: flex;
justify-content: center;
@@ -158,7 +154,7 @@ html[data-theme="dark"] .welcome p {
outline-offset: 3px;
}
-/* Navbar */
+/* ── Navbar ── */
.navbar {
position: sticky;
top: 0;
@@ -176,7 +172,6 @@ html[data-theme="dark"] .welcome p {
display: flex;
align-items: center;
justify-content: space-between;
- flex-wrap: wrap;
gap: 1rem;
}
@@ -199,10 +194,10 @@ html[data-theme="dark"] .welcome p {
flex-shrink: 0;
}
+/* Desktop links — visible by default */
.navbar-links {
display: flex;
gap: 1.75rem;
- flex-wrap: wrap;
}
.navbar-link {
@@ -237,6 +232,34 @@ html[data-theme="dark"] .welcome p {
transform: scaleX(1);
}
+/* Hamburger — hidden on desktop */
+.navbar-hamburger {
+ display: none;
+ flex-direction: column;
+ justify-content: center;
+ gap: 5px;
+ background: none;
+ border: none;
+ cursor: pointer;
+ padding: 4px;
+ color: #213547;
+}
+
+.hamburger-line {
+ display: block;
+ width: 22px;
+ height: 2px;
+ background-color: currentColor;
+ border-radius: 2px;
+ transition: transform 0.3s ease, opacity 0.3s ease;
+}
+
+/* Mobile menu — hidden on desktop */
+.navbar-mobile-menu {
+ display: none;
+}
+
+/* Dark mode */
html[data-theme="dark"] .navbar {
background: rgba(0, 0, 0, 0.85);
border-bottom-color: #222;
@@ -251,23 +274,20 @@ html[data-theme="dark"] .navbar-link {
color: #9fb8cc;
}
-@media (max-width: 600px) {
- .navbar {
- padding: 0.75rem 1rem;
- }
+html[data-theme="dark"] .navbar-hamburger {
+ color: #9fb8cc;
+}
- .navbar-content {
- flex-direction: column;
- align-items: flex-start;
- gap: 0.6rem;
- }
+html[data-theme="dark"] .navbar-mobile-menu {
+ border-top-color: #222;
+}
- .navbar-links {
- gap: 1.1rem;
- }
+html[data-theme="dark"] .mobile-link {
+ color: #9fb8cc;
+ border-bottom-color: #1a1a1a;
}
-/* Footer */
+/* ── Footer ── */
.footer {
width: 100%;
margin-top: 3rem;
@@ -311,7 +331,46 @@ html[data-theme="dark"] .navbar-link {
color: #666;
}
+/* ── Mobile — everything under 600px ── */
@media (max-width: 600px) {
+ .navbar {
+ padding: 0.75rem 1rem;
+ }
+
+ /* hide desktop links */
+ .navbar-links {
+ display: none;
+ }
+
+ /* show hamburger */
+ .navbar-hamburger {
+ display: flex;
+ }
+
+ /* show mobile dropdown */
+ .navbar-mobile-menu {
+ display: flex;
+ flex-direction: column;
+ padding: 0.75rem 1rem 1rem;
+ gap: 0.75rem;
+ border-top: 1px solid #ececec;
+ }
+
+ .mobile-link {
+ color: #444;
+ text-decoration: none;
+ font-weight: 500;
+ font-size: 0.95rem;
+ padding: 0.4rem 0;
+ border-bottom: 1px solid #f0f0f0;
+ transition: color 0.2s ease;
+ }
+
+ .mobile-link:hover,
+ .mobile-link.active {
+ color: #8e8dd3;
+ }
+
.footer {
padding: 1.5rem 1rem;
}
@@ -319,4 +378,286 @@ html[data-theme="dark"] .navbar-link {
.footer-links {
gap: 1rem;
}
+}
+/* Products Page */
+.products-page {
+ padding: 2rem 0;
+}
+
+.products-heading {
+ font-size: 1.8rem;
+ margin-bottom: 2rem;
+ text-align: center;
+}
+
+.products-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
+ gap: 1.5rem;
+}
+
+/* Product Card */
+.product-card {
+ border: 1px solid #ececec;
+ border-radius: 12px;
+ padding: 1rem;
+ display: flex;
+ flex-direction: column;
+ gap: 0.75rem;
+ transition: box-shadow 0.2s ease;
+ background: #fff;
+}
+
+.product-card:hover {
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
+}
+
+.product-image {
+ width: 100%;
+ height: 180px;
+ object-fit: contain;
+}
+
+.product-info {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5rem;
+ flex: 1;
+}
+
+.product-title {
+ font-size: 0.9rem;
+ font-weight: 500;
+ color: #213547;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+}
+
+.product-price {
+ font-size: 1.1rem;
+ font-weight: 700;
+ color: #8e8dd3;
+}
+
+.add-to-cart-btn {
+ margin-top: auto;
+ padding: 0.5rem 1rem;
+ background: #8e8dd3;
+ color: #fff;
+ border: none;
+ border-radius: 8px;
+ font-size: 0.9rem;
+ font-weight: 500;
+ cursor: pointer;
+ transition: background 0.2s ease;
+}
+
+.add-to-cart-btn:hover {
+ background: #7a79c0;
+}
+
+/* Cart Page */
+.cart-page {
+ padding: 2rem 0;
+ max-width: 800px;
+ margin: 0 auto;
+}
+
+.cart-heading {
+ font-size: 1.8rem;
+ margin-bottom: 2rem;
+ text-align: center;
+}
+
+.cart-items {
+ display: flex;
+ flex-direction: column;
+ gap: 1rem;
+}
+
+.cart-item {
+ display: flex;
+ align-items: center;
+ gap: 1rem;
+ padding: 1rem;
+ border: 1px solid #ececec;
+ border-radius: 12px;
+ background: #fff;
+}
+
+.cart-item-image {
+ width: 80px;
+ height: 80px;
+ object-fit: contain;
+ flex-shrink: 0;
+}
+
+.cart-item-info {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ gap: 0.4rem;
+}
+
+.cart-item-title {
+ font-size: 0.9rem;
+ font-weight: 500;
+ color: #213547;
+}
+
+.cart-item-price {
+ font-size: 0.85rem;
+ color: #666;
+}
+
+.cart-item-controls {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ margin-top: 0.25rem;
+}
+
+.quantity-btn {
+ width: 28px;
+ height: 28px;
+ border: 1px solid #ececec;
+ border-radius: 6px;
+ background: #f8f8f8;
+ font-size: 1rem;
+ cursor: pointer;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ transition: background 0.2s ease;
+}
+
+.quantity-btn:hover {
+ background: #ececec;
+}
+
+.cart-item-quantity {
+ font-weight: 600;
+ min-width: 20px;
+ text-align: center;
+}
+
+.remove-btn {
+ padding: 0.25rem 0.6rem;
+ background: none;
+ border: 1px solid #e24b4a;
+ border-radius: 6px;
+ color: #e24b4a;
+ font-size: 0.8rem;
+ cursor: pointer;
+ transition: all 0.2s ease;
+}
+
+.remove-btn:hover {
+ background: #e24b4a;
+ color: #fff;
+}
+
+.cart-item-subtotal {
+ font-weight: 700;
+ color: #8e8dd3;
+ font-size: 1rem;
+ flex-shrink: 0;
+}
+
+.cart-total {
+ margin-top: 2rem;
+ padding: 1rem;
+ border-top: 2px solid #ececec;
+ text-align: right;
+ font-size: 1.2rem;
+}
+
+/* Empty Cart */
+.empty-cart {
+ text-align: center;
+ padding: 4rem 0;
+}
+
+.empty-cart-heading {
+ font-size: 1.5rem;
+ margin-bottom: 0.5rem;
+ color: #213547;
+}
+
+.empty-cart-sub {
+ color: #666;
+}
+
+/* Dark mode for cart and products */
+html[data-theme="dark"] .product-card,
+html[data-theme="dark"] .cart-item {
+ background: #111;
+ border-color: #222;
+}
+
+html[data-theme="dark"] .product-title,
+html[data-theme="dark"] .cart-item-title {
+ color: #7da2c3;
+}
+
+html[data-theme="dark"] .quantity-btn {
+ background: #222;
+ border-color: #333;
+ color: #9fb8cc;
+}
+
+html[data-theme="dark"] .quantity-btn:hover {
+ background: #333;
+}
+
+html[data-theme="dark"] .cart-total {
+ border-top-color: #222;
+}
+
+@media (max-width: 600px) {
+ .products-grid {
+ grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
+ }
+
+ .cart-item {
+ flex-wrap: wrap;
+ }
+
+ .cart-item-subtotal {
+ width: 100%;
+ text-align: right;
+ }
+}
+/* Products and Cart wrappers */
+.products-wrapper {
+ max-width: 1100px;
+ margin: 0 auto;
+ padding: 2rem 1.5rem;
+}
+
+.cart-wrapper {
+ max-width: 900px;
+ margin: 0 auto;
+ padding: 2rem 1.5rem;
+}
+/* Toast notification */
+.toast {
+ position: absolute;
+ top: 10px;
+ left: 50%;
+ transform: translateX(-50%);
+ background: #8e8dd3;
+ color: #fff;
+ padding: 0.4rem 1rem;
+ border-radius: 20px;
+ font-size: 0.85rem;
+ font-weight: 500;
+ z-index: 10;
+ white-space: nowrap;
+}
+
+.product-card {
+ position: relative;
}
\ No newline at end of file
diff --git a/src/App.jsx b/src/App.jsx
index 2db0f85..15772ae 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -4,11 +4,15 @@ import { Route, Routes } from "react-router-dom";
import ErrorPage from "./components/ErrorPage.jsx";
import Footer from "./components/Footer.jsx";
import Navbar from "./components/Navbar.jsx";
+import ScrollToTop from "./components/ScrollToTop.jsx";
+import ProductsPage from "./pages/ProductsPage.jsx";
+import CartPage from "./pages/CartPage.jsx";
function App() {
return (
<>
-
${product.price.toFixed(2)}
+ ++ Go to the Products page and add some items! +
++ ${item.price.toFixed(2)} each +
++ ${(item.price * item.quantity).toFixed(2)} +
+Oops!
+{error}
+