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

Product app has been done #37

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
17 changes: 0 additions & 17 deletions .eslintrc.json

This file was deleted.

8 changes: 0 additions & 8 deletions .prettierrc.json

This file was deleted.

48,576 changes: 29,208 additions & 19,368 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 2 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"react-scripts": "^2.1.3",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand All @@ -17,12 +17,6 @@
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
Expand All @@ -34,15 +28,5 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.0",
"prettier": "^2.7.1"
},
"lint": "eslint .",
"lint:fix": "eslint --fix",
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc"
}
}
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script src="../src/index.js" type="text/jsx"></script>
</body>
</html>
8 changes: 3 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

import Products from './components/Products';


const products = [
{
id: 1,
Expand Down Expand Up @@ -84,12 +84,10 @@ const products = [
];

const App = () => {
return (
<div>
return <div>
<h1 className="title">BD Store</h1>
<Products />
<Products products={products}/>
</div>
);
};

export default App;
28 changes: 14 additions & 14 deletions src/components/Product.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/* eslint-disable react/prop-types */
import React from 'react';

const Product = () => {
return (
<article className="product">
<img src="" 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>
<button className="product__btn btn">Add to cart</button>
</div>
</article>
);
};
const Product = (prop) => {
const {title, images, rating, count, price, description, category} = prop;
return (<div className='product'>
<img src={images} alt={title} />
<div className="product__details">
<h4 className="product__title">{category} - {title}</h4>
<p className='product__price'>Price: $ {price}</p>
<p className='product__rating'>Rating:{rating} {count} rate/5</p>
<p className="product__desc">Description: {description}</p>
<button className="product__btn btn">Add to cart</button>
</div>
</div>
);
};

export default Product;
17 changes: 17 additions & 0 deletions src/components/Products.js
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
import React from "react";
/* eslint-disable react/prop-types */
import Product from './Product';


const Products = (prop) => {

const {products} = prop;
return (
<article className="article-products">
<div className="products">
{ products.map((product, index)=> <Product key={index} count={product.rating.count} rating={product.rating.rate} title={product.title} price={product.price} description={product.description} category={product.category} images={product.image} />)}
</div>
</article>
);
}

export default Products;