Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment Completed #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const App = () => {
return (
<div>
<h1 className="title">BD Store</h1>
<Products />
<Products products={products} />
</div>
);
};
Expand Down
16 changes: 8 additions & 8 deletions src/components/Product.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* eslint-disable react/prop-types */
import React from 'react';

const Product = () => {
const Product = (props) => {
const { image, title, price, rating, description } = props.product;
return (
<article className="product">
<img src="" alt="" />
<article className="product">
<img src={image} alt="" />
<div className="product__details">
<h4 className="product__title">product title</h4>
<p>Price: $ product price</p>
<p>Rating: product rating rate/5</p>
<p className="product__desc">Description: product.description</p>
<h4 className="product__title">{title}</h4>
<p className="product__price">Price: $ {price}</p>
<p className="product__rating">Rating: {rating.rate}/5</p>
<p className="product__desc">Description: {description}</p>
<button className="product__btn btn">Add to cart</button>
</div>
</article>
Expand Down
16 changes: 15 additions & 1 deletion src/components/Products.js
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
/* eslint-disable react/prop-types */
import React from 'react';
import Product from './Product';

function Products(props) {
const { products } = props;
return (
<div className="products">
{products.map((product) => (
<Product key={product.id} product={product} />
))}
</div>
);
}

export default Products;
3 changes: 1 addition & 2 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ img {
display: flex;
flex-direction: column;
}
.product__img {
}

.product__details {
padding: 0.5rem;
display: flex;
Expand Down