deep subcategory solution
This commit is contained in:
30
frontend-react/src/components/widgets/DeepCategoryWrapper.js
Normal file
30
frontend-react/src/components/widgets/DeepCategoryWrapper.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import React from "react";
|
||||
import Select from "react-select";
|
||||
import { subcategorywrapper } from "utils/subcategorywrapper";
|
||||
import { hoc } from "utils/helpers";
|
||||
|
||||
class DeepCategoryWrapper extends React.Component {
|
||||
handleOptionChange = selectedOption => {
|
||||
const { depth, onSubCategoryChanged } = this.props;
|
||||
onSubCategoryChanged({ selectedOption, depth });
|
||||
};
|
||||
|
||||
render() {
|
||||
const { options, depth, childrenComponents } = this.props;
|
||||
const {
|
||||
subcategory: { [depth]: deepSubCategory }
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Select
|
||||
value={deepSubCategory || null}
|
||||
onChange={this.handleOptionChange}
|
||||
options={options}
|
||||
/>
|
||||
{hoc(deepSubCategory && deepSubCategory.value, childrenComponents)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
export default subcategorywrapper(DeepCategoryWrapper);
|
||||
Reference in New Issue
Block a user