diff --git a/src/components/ShoppingCard/ShoppingCard.jsx b/src/components/ShoppingCard/ShoppingCard.jsx index a423228..8d48d44 100644 --- a/src/components/ShoppingCard/ShoppingCard.jsx +++ b/src/components/ShoppingCard/ShoppingCard.jsx @@ -12,13 +12,11 @@ export default function ShoppingCard({ id, title, image, price, rating }) { {title}

- {title.length > 25 ? `${title.slice(0, 25)}...` : title}

@@ -28,7 +26,6 @@ export default function ShoppingCard({ id, title, image, price, rating }) {

{price}$

-
diff --git a/src/pages/products/index.js b/src/pages/products/index.js deleted file mode 100644 index 37abe94..0000000 --- a/src/pages/products/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import React from "react" - -export default function Products() { - return
Products
-} diff --git a/src/pages/products/index.jsx b/src/pages/products/index.jsx new file mode 100644 index 0000000..eb1ad59 --- /dev/null +++ b/src/pages/products/index.jsx @@ -0,0 +1,28 @@ +import ShoppingCard from "@/components/ShoppingCard/ShoppingCard" + +import { useEffect, useState } from "react" + +const AllProducts = () => { + const [products, setProducts] = useState([]) + + function fetchProducts() { + fetch("https://fakestoreapi.com/products") + .then((res) => res.json()) + .then((products) => setProducts(products)) + } + useEffect(() => { + fetchProducts() + }, []) + + return ( +
+

All Products

+
+ {products.map((product) => { + return + })} +
+
+ ) +} +export default AllProducts