-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Se crea filterPanel y se ajustan estilos del panel
- Loading branch information
Showing
8 changed files
with
110 additions
and
10 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const priceFilter = (cost) => { | ||
return (product) => { | ||
switch (cost) { | ||
case 1: | ||
return product.cost <= 200; | ||
case 2: | ||
return product.cost > 200 && product.cost <= 500; | ||
case 3: | ||
return product.cost > 500 && product.cost <= 1000; | ||
case 4: | ||
return product.cost > 1001 && product.cost <= 2000; | ||
case 5: | ||
return product.cost > 2000; | ||
default: | ||
return product; | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { useState } from "react"; | ||
import "./products.scss"; | ||
|
||
const optionsData = { | ||
price: { | ||
0: "Any price", | ||
1: "0 - 200 coins", | ||
2: "201 - 500 coins", | ||
3: "501 - 1000 coins", | ||
4: "1001 - 2000 coins", | ||
5: "+ 2000 coins", | ||
}, | ||
}; | ||
|
||
const FilterPanel = ({ currentAmount, totalAmount, onFilter }) => { | ||
return ( | ||
<> | ||
<div className="filter-container"> | ||
<div className="pagination-info"> | ||
Showing {currentAmount} of {totalAmount} products | ||
</div> | ||
<div className="filter">Filter by:</div> | ||
<select className="filter-select" onChange={(e) => onFilter(e)}> | ||
{Object.entries(optionsData.price).map(([key, value], index) => { | ||
return ( | ||
<option key={index} value={key}> | ||
{value} | ||
</option> | ||
); | ||
})} | ||
</select> | ||
</div> | ||
</> | ||
); | ||
}; | ||
export default FilterPanel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters