diff --git a/src/components/SearchFiltersMobile/SearchFiltersMobile.js b/src/components/SearchFiltersMobile/SearchFiltersMobile.js
index df4c1571..99fbc629 100644
--- a/src/components/SearchFiltersMobile/SearchFiltersMobile.js
+++ b/src/components/SearchFiltersMobile/SearchFiltersMobile.js
@@ -131,13 +131,15 @@ class SearchFiltersMobileComponent extends Component {
const categoryLabel = intl.formatMessage({
id: 'SearchFiltersMobile.categoryLabel',
});
+ const initialCategory = urlQueryParams[CATEGORY_URL_PARAM];
+
const categoryFilter = categories ? (
) : null;
diff --git a/src/components/SelectSingleFilterMobile/SelectSingleFilterMobile.js b/src/components/SelectSingleFilterMobile/SelectSingleFilterMobile.js
index 966e94a1..b4ac02fb 100644
--- a/src/components/SelectSingleFilterMobile/SelectSingleFilterMobile.js
+++ b/src/components/SelectSingleFilterMobile/SelectSingleFilterMobile.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import { object, string, func, arrayOf, shape } from 'prop-types';
+import { string, func, arrayOf, shape } from 'prop-types';
import classNames from 'classnames';
import { FormattedMessage } from 'react-intl';
@@ -28,12 +28,9 @@ class SelectSingleFilterMobile extends Component {
}
render() {
- const { rootClassName, className, urlQueryParams, urlParam, paramLabel, options } = this.props;
+ const { rootClassName, className, paramLabel, options, initialValue } = this.props;
- // current value of this custom attribute filter
- const currentValue = urlQueryParams[urlParam];
-
- const labelClass = currentValue ? css.filterLabelSelected : css.filterLabel;
+ const labelClass = initialValue ? css.filterLabelSelected : css.filterLabel;
const optionsContainerClass = this.state.isOpen
? css.optionsContainerOpen
@@ -54,7 +51,7 @@ class SelectSingleFilterMobile extends Component {
{options.map(option => {
// check if this option is selected
- const selected = currentValue === option.key;
+ const selected = initialValue === option.key;
// menu item border class
const optionBorderClass = selected ? css.optionBorderSelected : css.optionBorder;
return (
@@ -77,12 +74,12 @@ class SelectSingleFilterMobile extends Component {
SelectSingleFilterMobile.defaultProps = {
rootClassName: null,
className: null,
+ initialValue: null,
};
SelectSingleFilterMobile.propTypes = {
rootClassName: string,
className: string,
- urlQueryParams: object.isRequired,
urlParam: string.isRequired,
paramLabel: string.isRequired,
onSelect: func.isRequired,
@@ -93,6 +90,7 @@ SelectSingleFilterMobile.propTypes = {
label: string.isRequired,
})
).isRequired,
+ initialValue: string,
};
export default SelectSingleFilterMobile;