Add: Json files for nearby busstops and a component for accessing said json files
This commit is contained in:
41
src/components/FindStops.js
Normal file
41
src/components/FindStops.js
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
import globData from '../GlobalData.js';
|
||||
|
||||
import locationuser1 from '../APIexamples/locationuser1.json'
|
||||
import locationuser2 from '../APIexamples/locationuser2.json'
|
||||
import locationuser3 from '../APIexamples/locationuser3.json'
|
||||
import locationuser4 from '../APIexamples/locationuser4.json'
|
||||
|
||||
import Button from './Button.js';
|
||||
import disruptIcon from '../img/flash.svg';
|
||||
|
||||
class FindStops extends Button {
|
||||
state = {
|
||||
locations : ""
|
||||
}
|
||||
findStops = () => {
|
||||
if(globData.user.deviceId === "1"){
|
||||
this.state.locations = locationuser1.StopLocation
|
||||
}else if (globData.user.deviceId === "2"){
|
||||
this.state.locations = locationuser2.StopLocation
|
||||
}else if (globData.user.deviceId === "3"){
|
||||
this.state.locations = locationuser3.StopLocation
|
||||
}else if (globData.user.deviceId === "4"){
|
||||
this.state.locations = locationuser4.StopLocation
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
<Button onClick={[this.findStops]} className="disruptBtn">
|
||||
<img src={disruptIcon} alt="" />
|
||||
<span>Select nearby stops</span>
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default FindStops;
|
0
src/components/StopSelector.js
Normal file
0
src/components/StopSelector.js
Normal file
Reference in New Issue
Block a user