saving udates, not missing much i guess

This commit is contained in:
jenzur
2019-07-14 02:28:16 +02:00
parent 9232830451
commit 3730230925
14 changed files with 537 additions and 134 deletions
@@ -0,0 +1,45 @@
import React, { Component } from "react";
import Facade from "../Datafacade/datafacade";
import { NavLink } from 'react-router-dom';
class MapsSearch extends Component {
state = {
maps: []
};
componentDidMount = async () => {
const maps = await Facade.getMapsBySearchCache(this.props.keyword);
this.setState({ maps });
};
componentDidUpdate = async prevProps => {
if (this.props.keyword !== prevProps.keyword) {
const maps = await Facade.getMapsBySearchCache(this.props.keyword);
this.setState({ maps });
}
}
render() {
return (
<React.Fragment>
<div className="container mm">
<div className="row">
{this.state.maps.map(e => (
<div className="item" key={"mapdivs/" + e.mapname + "/" + e.mapstage}>
<div className="box_grid">
<NavLink to={'/map/' + e.mapname + "/" + e.mapstage}>
<strong className="col-lg-1 col-centered" /> Map: {e.mapname}<br />
<strong className="col-lg-1 col-centered" /> Stage: {e.mapstage}<br />
<br />
<br />
</NavLink>
</div>
</div>
))}
</div>
</div>
</React.Fragment>
);
}
}
export default MapsSearch;