Skip to content

Commit

Permalink
displays train eta
Browse files Browse the repository at this point in the history
  • Loading branch information
minaorangina committed Dec 30, 2016
1 parent caef826 commit 088872c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/js/components/train.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import React from 'react';

export default function Train ({ data }) {

const destination = 'this will be the destination';
const arrivals = data.map((arrival, i) => {
export default function Train ({ data, destination }) {
const arrivals = data.length > 0 && data.map((arrival, i) => {
const trainDestination = arrival.destination.location[0].locationName;
return (
<div className="arrival-item" key={ i }>
{ arrival }
{ `${arrival.std} to ${trainDestination}` }
<div className="info">{ arrival.etd }</div>
</div>
);
});

return (
<div className='card'>
<h3>{ `Train: ${destination}` }</h3>
<h3>{ `Train: going to ${destination}` }</h3>
{ arrivals }
</div>
);
Expand Down

0 comments on commit 088872c

Please sign in to comment.