diff --git a/src/components/templates/Search/filterPrice.tsx b/src/components/templates/Search/filterPrice.tsx index 620138eba..d8ceb6636 100644 --- a/src/components/templates/Search/filterPrice.tsx +++ b/src/components/templates/Search/filterPrice.tsx @@ -11,28 +11,20 @@ import Button from '../../atoms/Button' const cx = classNames.bind(styles) -const filterItemsPrice = [ +const filterItems = [ { display: 'all', value: undefined }, { display: 'fixed price', value: FilterByPriceOptions.Fixed }, - { display: 'dynamic price', value: FilterByPriceOptions.Dynamic } -] - -const filterItemsType = [ - { display: 'all', value: undefined }, - { display: 'algorithms', value: FilterByTypeOptions.Algorithm }, - { display: 'data sets', value: FilterByTypeOptions.Data } + { display: 'dynamic price', value: FilterByPriceOptions.Dynamic }, + { display: 'data sets', value: FilterByTypeOptions.Data }, + { display: 'algorithms', value: FilterByTypeOptions.Algorithm } ] export default function FilterPrice({ priceType, - setPriceType, - serviceType, - setServiceType + setPriceType }: { priceType: string setPriceType: React.Dispatch> - serviceType: string - setServiceType: React.Dispatch> }): ReactElement { const navigate = useNavigate() @@ -41,57 +33,35 @@ export default function FilterPrice({ if (filterBy) { urlLocation = `${urlLocation}&priceType=${filterBy}` } + console.log('FILTER BY: ', filterBy) setPriceType(filterBy) navigate(urlLocation) } - async function applyTypeFilter(filterBy: string) { - let urlLocation = await addExistingParamsToUrl(location, 'serviceType') - if (filterBy) { - urlLocation = `${urlLocation}&serviceType=${filterBy}` - } - setServiceType(filterBy) - navigate(urlLocation) - } - return (
- {filterItemsType.map((e, index) => { - const filter = cx({ - [styles.selected]: e.value === serviceType, - [styles.filter]: true - }) - return ( - - ) - })} -
-
- {filterItemsPrice.map((e, index) => { - const filter = cx({ + {filterItems.map((e, index) => { + const selectFilter = cx({ [styles.selected]: e.value === priceType, [styles.filter]: true }) + const isSelected = e.value === priceType return (