Update filter state with clicked coordinates.

This commit is contained in:
Dana Lambert 2021-10-19 08:48:45 +13:00
parent 05665b545b
commit 5bef4efe36
3 changed files with 18 additions and 9 deletions

View file

@ -11,8 +11,11 @@ export default class MainPage extends React.Component {
super(props);
this.state = {
plants: []
plants: [],
filters: {}
}
this.updateFilterState = this.updateFilterState.bind(this);
}
updatePlants() {
@ -25,6 +28,10 @@ export default class MainPage extends React.Component {
})
}
updateFilterState(newFilter) {
this.setState({ filters: { ...this.state.filters, ...newFilter } })
}
componentDidMount() {
this.updatePlants()
}
@ -33,7 +40,7 @@ export default class MainPage extends React.Component {
return (
<Container fluid className='main-container p-0'>
<Header/>
<Stepper plants={this.state.plants} />
<Stepper plants={this.state.plants} updateFilterState={this.updateFilterState} />
</Container>
)
}