Commit 9077f836 authored by Sharp Hall's avatar Sharp Hall

Report mi or feet depending on distance

parent 246db87e
......@@ -47,16 +47,20 @@ function getSeptaTransitView() {
$(function () {
console.log("Hello world!")
getSeptaTransitView();
});
class Vehicle extends React.Component {
render() {
console.log(this.props.vehicleData);
var distance;
if (this.props.vehicleData.distance > 0.2) {
distance = this.props.vehicleData.distance.toFixed(2) + " mi";
} else {
distance = (this.props.vehicleData.distance * 5280).toFixed(0) + " feet";
}
return (
<div>
{this.props.vehicleData.Direction} {this.props.vehicleData.route} {this.props.vehicleData.distance} mi away
<div className="vehicle">
{this.props.vehicleData.Direction} {this.props.vehicleData.route} {distance} away
</div>
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment