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 = () => {
|
||||
setActiveStep(0);
|
||||
setNextDisabled(true);
|
||||
props.resetFilterState()
|
||||
};
|
||||
|
||||
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.resetFilterState = this.resetFilterState.bind(this);
|
||||
}
|
||||
|
||||
updatePlants() {
|
||||
|
@ -33,6 +34,10 @@ export default class MainPage extends React.Component {
|
|||
this.updatePlants()
|
||||
}
|
||||
|
||||
resetFilterState() {
|
||||
this.setState({ filters: {} })
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.updatePlants()
|
||||
}
|
||||
|
@ -41,7 +46,11 @@ export default class MainPage extends React.Component {
|
|||
return (
|
||||
<Container fluid className='main-container p-0'>
|
||||
<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>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue