diff --git a/src/Pages/home/Home.tsx b/src/Pages/home/Home.tsx index 34de71a..456994c 100644 --- a/src/Pages/home/Home.tsx +++ b/src/Pages/home/Home.tsx @@ -1,7 +1,12 @@ -import React from 'react' +import React, { useContext } from 'react' import { AiFillStar, AiOutlineStar } from 'react-icons/ai' +import { CartContext } from '../../context/CartContextProvider' +import Card from '../../components/cart/Card'; const Home = () => { + + const productContext = useContext(CartContext); + return ( <>
@@ -9,46 +14,9 @@ const Home = () => {
-
- -
-

Test Title ...

-
-
- - - - - -
-

231$

-
- -
-
-
- -
-

Test Title ...

-
-
- - - - - -
-

231$

-
- -
-
+ { + productContext.shop.map(products => ) + }
) diff --git a/src/components/cart/Card.tsx b/src/components/cart/Card.tsx new file mode 100644 index 0000000..ffa00a4 --- /dev/null +++ b/src/components/cart/Card.tsx @@ -0,0 +1,33 @@ +import React from 'react' + +import { AiFillStar, AiOutlineStar } from 'react-icons/ai' +import { Produts } from '../../types/products.types' + +const Card = ({ id, title, image, price, rating: { rate } }: Produts) => { + return ( +
+ products +
+

{title.slice(0, 10)}

+
+
+ {Array(Math.ceil(rate)) + .fill(0) + .map(() => ( + + ))} + {Array(5 - Math.ceil(rate)) + .fill(0) + .map(() => ( + + ))} +
+

{price}$

+
+ +
+
+ ) +} + +export default Card