Skip to content

Commit

Permalink
Se ajustan estilos de modal coins para safari
Browse files Browse the repository at this point in the history
  • Loading branch information
hendaniel committed Sep 7, 2020
1 parent 961d2ec commit 108c344
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 24 deletions.
10 changes: 5 additions & 5 deletions src/Utils/index.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export const priceFilter = (cost) => {
return (product) => {
switch (cost) {
case 1:
case "1":
return product.cost <= 200;
case 2:
case "2":
return product.cost > 200 && product.cost <= 500;
case 3:
case "3":
return product.cost > 500 && product.cost <= 1000;
case 4:
case "4":
return product.cost > 1001 && product.cost <= 2000;
case 5:
case "5":
return product.cost > 2000;
default:
return product;
Expand Down
7 changes: 4 additions & 3 deletions src/components/Modals/modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
background: #43a764;
}
.coins-header {
background: #c7aa0a;
background: #e0ca49;
}

.modal-close-button {
Expand Down Expand Up @@ -85,10 +85,11 @@ button {

.coins {
cursor: pointer;
font-size: 20px;
font-size: 30px;
margin-top: 10px;
background-color: transparent;
outline: none;
color: #c7aa0a;
color: #e0ca49;
}

.gif {
Expand Down
23 changes: 8 additions & 15 deletions src/components/Products/ProductsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,29 @@ const ITEMS_PER_PAGE = 16;
const ProductsList = () => {
const { products, setProductResponse } = useContext(ProductsContext);

const [filteredProducts, setProducts] = useState([]);

useEffect(() => {
if (!products) return;
setProducts(products);
}, [products]);

const [filteredProducts, setProducts] = useState(products);

const { next, prev, currentData, currentAmount } = usePagination(
const { next, prev, currentData, currentAmount, jump } = usePagination(
filteredProducts,
ITEMS_PER_PAGE
);

const onPrev = () => {
prev();
window.scrollTo(0, 0);
};
const onNext = () => {
next();
window.scrollTo(0, 0);
};

const handleFilter = (event) => {
setProducts(products.filter(priceFilter(event.target.value)));
jump(1);
};

if (filteredProducts.length) {
return (
<>
<FilterPanel
currentAmount={currentAmount()}
totalAmount={products.length}
totalAmount={filteredProducts.length}
onFilter={handleFilter}
/>
<div className="cards">
Expand All @@ -53,8 +46,8 @@ const ProductsList = () => {
<div className="container-pagination">
<div className="pagination">
<ul>
<button onClick={onPrev}>Previous</button>
<button onClick={onNext}>Next</button>
<button onClick={() => prev()}>Previous</button>
<button onClick={() => next()}>Next</button>
</ul>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Products/products.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
margin: 15px;
transition: all 0.4s cubic-bezier(0.175, 0.885, 0, 1);
background-color: #fff;
width: 250px;
width: 270px;
height: 300px;
position: relative;
border-radius: 12px;
Expand Down

0 comments on commit 108c344

Please sign in to comment.