From 38fca5a78328cf2507b35cfc59ea4345ed6edda0 Mon Sep 17 00:00:00 2001 From: ronreg-ribdev <56719257+ronreg-ribdev@users.noreply.github.com> Date: Mon, 1 Jun 2020 02:48:17 -0700 Subject: [PATCH] Improve elevator widget --- src/js/components/root.js | 79 ++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 31 deletions(-) diff --git a/src/js/components/root.js b/src/js/components/root.js index 8fd786b..f931642 100644 --- a/src/js/components/root.js +++ b/src/js/components/root.js @@ -5,8 +5,10 @@ import { HeaderBar } from "./lib/header-bar.js" class ElevatorWidget extends Component { render() { - return (
- Elevator info + return (
+

BART Info - Elevator status

+ Route planner + No elevators are known to be out of service.
); } } @@ -39,14 +41,13 @@ class TimeScheduleWidget extends Component { } } - -export class Root extends Component { +class RoutePlanner extends Component { constructor(props) { super(props); - this.state = store.state; - store.setStateHandler((newState) => { - this.setState(newState); - }); + this.state = { + fromStation: null, + toStation: null, + }; } stationSearch() { @@ -64,7 +65,7 @@ export class Root extends Component { } renderStationOptions() { - const stations = this.state.stations || []; + const stations = this.props.stations; return _.map(stations, (station) => { const abbr = station.abbr; const name = station.name; @@ -87,32 +88,48 @@ export class Root extends Component { ); } + render() { + return ( +
+

BART Info

+ Elevator information +
+
+ +
+
+ +
+
+ Search scheduled trains: + { this.renderStationForm() } +
+
+
+ ); + } +} + + +export class Root extends Component { + constructor(props) { + super(props); + this.state = store.state; + store.setStateHandler((newState) => { + this.setState(newState); + }); + } + render() { return (
- - }/> - { - return ( -
-

BART Info

- Elevator information -
-
- -
-
- -
-
- Search scheduled trains: - { this.renderStationForm() } -
-
-
- )}} - /> + + }/> + + } />
)