diff --git a/src/js/components/root.js b/src/js/components/root.js index 16c928a..a864427 100644 --- a/src/js/components/root.js +++ b/src/js/components/root.js @@ -13,8 +13,18 @@ export class Root extends Component { }); } - action() { - console.log("Clickin'"); + stationSearch() { + console.log("Searching"); + } + + changeStation(evt) { + const target = evt.target.name; + const value = evt.target.value; + if (target === "fromStation") { + this.setState({fromStation: value}); + } else if (target === "toStation") { + this.setState({toStation: value}); + } } renderStationOptions() { @@ -27,16 +37,17 @@ export class Root extends Component { } renderStationForm() { - return (
+ return ( From: - { this.renderStationOptions() }
To: - { this.renderStationOptions() } +
); } @@ -60,10 +71,6 @@ export class Root extends Component {
Search scheduled trains: { this.renderStationForm() } -
- From: -
-