Update reset operation to also reset filters
This commit is contained in:
parent
8638fd3041
commit
05121fbdba
2 changed files with 11 additions and 1 deletions
|
@ -40,6 +40,7 @@ export default function StepperWizard(props) {
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
setActiveStep(0);
|
setActiveStep(0);
|
||||||
setNextDisabled(true);
|
setNextDisabled(true);
|
||||||
|
props.resetFilterState()
|
||||||
};
|
};
|
||||||
|
|
||||||
let CurrentStep = activeStep >= steps.length ? steps[steps.length - 1].component : steps[activeStep].component;
|
let CurrentStep = activeStep >= steps.length ? steps[steps.length - 1].component : steps[activeStep].component;
|
||||||
|
|
|
@ -16,6 +16,7 @@ export default class MainPage extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateFilterState = this.updateFilterState.bind(this);
|
this.updateFilterState = this.updateFilterState.bind(this);
|
||||||
|
this.resetFilterState = this.resetFilterState.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePlants() {
|
updatePlants() {
|
||||||
|
@ -33,6 +34,10 @@ export default class MainPage extends React.Component {
|
||||||
this.updatePlants()
|
this.updatePlants()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetFilterState() {
|
||||||
|
this.setState({ filters: {} })
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.updatePlants()
|
this.updatePlants()
|
||||||
}
|
}
|
||||||
|
@ -41,7 +46,11 @@ export default class MainPage extends React.Component {
|
||||||
return (
|
return (
|
||||||
<Container fluid className='main-container p-0'>
|
<Container fluid className='main-container p-0'>
|
||||||
<Header/>
|
<Header/>
|
||||||
<Stepper plants={this.state.plants} filters={this.state.filters} updateFilterState={this.updateFilterState} />
|
<Stepper
|
||||||
|
plants={this.state.plants}
|
||||||
|
filters={this.state.filters}
|
||||||
|
updateFilterState={this.updateFilterState}
|
||||||
|
resetFilterState={this.resetFilterState} />
|
||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue