Skip to content

Commit

Permalink
No hace falta archivo css para historial
Browse files Browse the repository at this point in the history
  • Loading branch information
hendaniel committed Sep 7, 2020
1 parent 38be913 commit f130da4
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 61 deletions.
2 changes: 1 addition & 1 deletion src/components/FilterPanel/FilterPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const optionsData = {
},
};

const FilterPanel = ({ currentAmount, totalAmount, onFilter }) => {
const FilterPanel = ({ currentAmount = 0, totalAmount = 0, onFilter }) => {
return (
<>
<div className="filter-container">
Expand Down
70 changes: 37 additions & 33 deletions src/components/Products/ProductsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,44 @@ const ProductsList = () => {
jump(1);
};

if (filteredProducts.length) {
return (
<>
<FilterPanel
currentAmount={currentAmount()}
totalAmount={filteredProducts.length}
onFilter={handleFilter}
/>
<div className="cards">
{currentData().map((item, key) => {
return (
<Product
item={item}
key={key}
setProductResponse={setProductResponse}
/>
);
})}
</div>
<div className="container-pagination">
<div className="pagination">
<ul>
<button onClick={() => prev()}>Previous</button>
<button onClick={() => next()}>Next</button>
</ul>
</div>
</div>
</>
);
}
return (
<div className="empty">
<h1>No hay productos</h1>
</div>
<>
{filteredProducts.length ? (
<>
<FilterPanel
currentAmount={currentAmount()}
totalAmount={filteredProducts.length}
onFilter={handleFilter}
/>
<div className="cards">
{currentData().map((item, key) => {
return (
<Product
item={item}
key={key}
setProductResponse={setProductResponse}
/>
);
})}
</div>
<div className="container-pagination">
<div className="pagination">
<ul>
<button onClick={() => prev()}>Previous</button>
<button onClick={() => next()}>Next</button>
</ul>
</div>
</div>
</>
) : (
<>
<FilterPanel onFilter={handleFilter} />
<div className="empty">
<h1>No hay productos</h1>
</div>
</>
)}
</>
);
};
export default ProductsList;
58 changes: 31 additions & 27 deletions src/components/ProductsHistory/ProductsHistory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,38 @@ const ProductsHistory = () => {
jump(1);
};

if (filteredProducts.length) {
return (
<>
<FilterPanel
currentAmount={currentAmount()}
totalAmount={filteredProducts.length}
onFilter={handleFilter}
/>
<div className="cards">
{currentData().map((item, key) => {
return <RedeemedProduct item={item} key={key} />;
})}
</div>
<div className="container-pagination">
<div className="pagination">
<ul>
<button onClick={() => prev()}>Previous</button>
<button onClick={() => next()}>Next</button>
</ul>
</div>
</div>
</>
);
}
return (
<div className="empty">
<h1>No hay productos canjeados</h1>
</div>
<>
{filteredProducts.length ? (
<>
<FilterPanel
currentAmount={currentAmount()}
totalAmount={filteredProducts.length}
onFilter={handleFilter}
/>
<div className="cards">
{currentData().map((item, key) => {
return <RedeemedProduct item={item} key={key} />;
})}
</div>
<div className="container-pagination">
<div className="pagination">
<ul>
<button onClick={() => prev()}>Previous</button>
<button onClick={() => next()}>Next</button>
</ul>
</div>
</div>
</>
) : (
<>
<FilterPanel onFilter={handleFilter} />
<div className="empty">
<h1>No hay productos</h1>
</div>
</>
)}
</>
);
};
export default ProductsHistory;
1 change: 1 addition & 0 deletions src/components/ProductsHistory/RedeemedProduct.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const Product = ({
<div className="info">
<span className="category">{category}</span>
<h3 className="title">{name}</h3>
<span className="category">{cost} coins</span>
</div>
</div>
);
Expand Down
Empty file.

0 comments on commit f130da4

Please sign in to comment.