From 8384ce27ccd74ed5ab3bd835d9a7be3ddd458818 Mon Sep 17 00:00:00 2001 From: hosead6168 Date: Mon, 21 Mar 2022 04:35:52 -0500 Subject: [PATCH] feat(*): added related products --- src/Components/Product/DetailProduct.jsx | 73 +++++++------- src/Components/Product/ProductItem.css | 8 ++ src/Components/Product/RelatedProducts.css | 74 +++++++++++++++ src/Components/Product/RelatedProducts.jsx | 105 +++++++++++++++++++++ 4 files changed, 228 insertions(+), 32 deletions(-) create mode 100644 src/Components/Product/RelatedProducts.css create mode 100644 src/Components/Product/RelatedProducts.jsx diff --git a/src/Components/Product/DetailProduct.jsx b/src/Components/Product/DetailProduct.jsx index a9842d30..065ce17a 100644 --- a/src/Components/Product/DetailProduct.jsx +++ b/src/Components/Product/DetailProduct.jsx @@ -2,9 +2,11 @@ import React, { useContext, useState, useEffect } from 'react'; import { useParams, Link } from 'react-router-dom'; -import ProductItem from './ProductItem'; +import RelatedProducts from './RelatedProducts'; import { GlobalState } from '../../GlobalState'; import './DetailProduct.css'; +import NavBar from '../../Components/NavBar/NavBar'; +import Footer from '../../Components/Footer/Footer'; const DetailProduct = () => { const params = useParams() @@ -25,38 +27,45 @@ const DetailProduct = () => { const { images, title, price, description, content, sold, category, product_id } = detailProduct; return ( <> -
-
-
- Product Detail -
-
-

{title}

-
#id: {product_id}
-
- $ {price} -

{description}

-

{content}

-

Sold: {sold}

- addCart(detailProduct)}> - Buy Now - -
-
-
-

Related Products

-
- { - products.map(product => { - return product.category === category - ? : null - }) - } -
-
-
+ + +
+
+
+ product +
+
+

{title || "No Title"}

+
#id: {product_id}
+

+ {description || "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."} +

+

{content || "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."}

+

Categories

+ {/* {category.map(item => {item})} */} + {category || "software"} +

Price

+

${price || "25"}

+

Sold: {sold}

+ addCart(detailProduct)}> + Buy Now + +
+
+
+
+

Related Products

+
+ { + products.map(product => { + return product.category === category + ? : null + }) + }
+
+