diff --git a/components/Countdown.jsx b/components/Countdown.jsx index f77fa64..ee0b0c4 100644 --- a/components/Countdown.jsx +++ b/components/Countdown.jsx @@ -28,7 +28,7 @@ const CountdownTimer = ({ endDate }) => { }, [endDate]); return ( -
+

April Sale Ends in

{expired ? ( diff --git a/components/Navbar.jsx b/components/Navbar.jsx index 7114db7..991ac61 100644 --- a/components/Navbar.jsx +++ b/components/Navbar.jsx @@ -1,5 +1,5 @@ import Link from "next/link"; -import { BsBag, BsHeart } from "react-icons/bs"; +import { BsBag } from "react-icons/bs"; import { useSelector } from "react-redux"; const Navbar = () => { @@ -53,24 +53,16 @@ const Navbar = () => { -
- +
+ + Sign in + {products.length} - {/* */} - {/* */}
); diff --git a/components/ProductItem.jsx b/components/ProductItem.jsx index 3eda78e..1cf144c 100644 --- a/components/ProductItem.jsx +++ b/components/ProductItem.jsx @@ -20,7 +20,7 @@ const ProductItem = ({ product }) => {

{product.title}

- {product.description.split(".")[0]}. + {product.description?.split(".")[0]}.

diff --git a/pages/index.js b/pages/index.js index 3c9cd9b..c87efe4 100644 --- a/pages/index.js +++ b/pages/index.js @@ -2,15 +2,24 @@ import Slider from "@/components/Slider"; import ProductsPage from "./products"; import { getAllProducts } from "@/prisma/products"; import Countdown from "@/components/Countdown"; +import MenProductsPage from "./products/men"; +import WomenProductsPage from "./products/women"; const HomePage = ({ products }) => { const endDate = new Date().getTime() + 48 * 60 * 60 * 1000; + const menProducts = products.filter((product) => product.category === "Men"); + const womenProducts = products.filter( + (product) => product.category === "Women" + ); + return (

+ +
); }; diff --git a/pages/products/index.js b/pages/products/index.js index 784071a..371a560 100644 --- a/pages/products/index.js +++ b/pages/products/index.js @@ -3,7 +3,7 @@ import { getAllProducts } from "@/prisma/products"; const ProductsPage = ({ products }) => { return ( -
+

Browse all products

diff --git a/pages/products/men.js b/pages/products/men.js index d07d33e..86b53f2 100644 --- a/pages/products/men.js +++ b/pages/products/men.js @@ -1,10 +1,10 @@ import ProductItem from "@/components/ProductItem"; import { getAllProducts } from "@/prisma/products"; -const men = ({ products }) => { +const MenProductsPage = ({ products }) => { return ( -
-

Browse all products

+
+

Browse men collection

{products.map((product) => ( @@ -15,7 +15,7 @@ const men = ({ products }) => { ); }; -export default men; +export default MenProductsPage; export const getServerSideProps = async () => { const products = await getAllProducts(); diff --git a/pages/products/women.js b/pages/products/women.js index ed3dcec..f7660b2 100644 --- a/pages/products/women.js +++ b/pages/products/women.js @@ -1,10 +1,10 @@ import ProductItem from "@/components/ProductItem"; import { getAllProducts } from "@/prisma/products"; -const women = ({ products }) => { +const WomenProductsPage = ({ products }) => { return ( -
-

Browse all products

+
+

Browse women collection

{products.map((product) => ( @@ -15,7 +15,7 @@ const women = ({ products }) => { ); }; -export default women; +export default WomenProductsPage; export const getServerSideProps = async () => { const products = await getAllProducts(); diff --git a/styles/globals.css b/styles/globals.css index 4ad0315..2ee6ea7 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -13,7 +13,7 @@ } .counting-bubble { - @apply absolute -right-2 -bottom-1 bg-black w-4 h-4 rounded-full flex justify-center items-center text-white text-xs; + @apply absolute -right-2 bottom-0 bg-black w-4 h-4 rounded-full flex justify-center items-center text-white text-xs; } .slider { diff --git a/utils/formatCurrency.js b/utils/formatCurrency.js index 4bd53bc..ec19df5 100644 --- a/utils/formatCurrency.js +++ b/utils/formatCurrency.js @@ -1,5 +1,5 @@ export function formatCurrency(price) { - return price.toLocaleString("en-US", { + return price?.toLocaleString("en-US", { style: "currency", currency: "USD", });