From 5c59866dc4d5faf2e4b68098da0c0a731c6a0305 Mon Sep 17 00:00:00 2001 From: williameriksson126 Date: Thu, 10 Dec 2020 09:56:24 +0100 Subject: [PATCH] Add: More progress regarding findstops button --- src/components/FindStops.js | 14 +++++++++----- src/components/NavigationDrawer.js | 2 ++ src/components/StopSelectButton.js | 22 ++++++++++++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 src/components/StopSelectButton.js diff --git a/src/components/FindStops.js b/src/components/FindStops.js index 99e5bdc..46a7d0d 100644 --- a/src/components/FindStops.js +++ b/src/components/FindStops.js @@ -6,22 +6,23 @@ import locationuser2 from '../APIexamples/locationuser2.json' import locationuser3 from '../APIexamples/locationuser3.json' import locationuser4 from '../APIexamples/locationuser4.json' +import StopSelectButton from './StopSelectButton.js'; import Button from './Button.js'; import disruptIcon from '../img/flash.svg'; class FindStops extends Button { state = { - locations : "" + locations : [] } findStops = () => { if(globData.user.deviceId === "1"){ - this.state.locations = locationuser1.StopLocation + this.state.locations = locationuser1.LocationList.StopLocation }else if (globData.user.deviceId === "2"){ - this.state.locations = locationuser2.StopLocation + this.state.locations = locationuser2.LocationList.StopLocation }else if (globData.user.deviceId === "3"){ - this.state.locations = locationuser3.StopLocation + this.state.locations = locationuser3.LocationList.StopLocation }else if (globData.user.deviceId === "4"){ - this.state.locations = locationuser4.StopLocation + this.state.locations = locationuser4.LocationList.StopLocation } } @@ -32,6 +33,9 @@ class FindStops extends Button { Select nearby stops + {this.state.locations.map((item) => + + )} ); } diff --git a/src/components/NavigationDrawer.js b/src/components/NavigationDrawer.js index 9bc3f5c..adb42f2 100644 --- a/src/components/NavigationDrawer.js +++ b/src/components/NavigationDrawer.js @@ -9,6 +9,7 @@ import Button from './Button.js'; import './css/NavigationDrawer.css'; import userIcon from '../img/user.svg'; +import FindStops from './FindStops.js'; class NavigationDrawer extends Component { @@ -68,6 +69,7 @@ class NavigationDrawer extends Component { + diff --git a/src/components/StopSelectButton.js b/src/components/StopSelectButton.js new file mode 100644 index 0000000..e326874 --- /dev/null +++ b/src/components/StopSelectButton.js @@ -0,0 +1,22 @@ +import React, {Component} from 'react'; +import globalData from '../GlobalData'; +import Button from './Button.js'; + +class StopSelectButton extends Component { + + selectStop = () => { + globalData.stop = this.props.stop + } + + render() { + return ( + <> + + + ); + } +} +// TODO Add css +export default StopSelectButton