-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(child-stop-details.js): Created basic template with data from ap…
…i ready to style - phase 1 #412
- Loading branch information
1 parent
5dde8db
commit 57cb055
Showing
6 changed files
with
82 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React, { Component } from 'react' | ||
|
||
import { getStopViewerConfig } from '../../util/state' | ||
import { stopTimeComparator } from '../../util/viewer' | ||
|
||
import StopTimeCell from './stop-time-cell' | ||
|
||
class ChildStopDetails extends Component { | ||
componentDidMount () { | ||
} | ||
|
||
getStopTime (childStopTimes) { | ||
let sortedStopTimes = [] | ||
sortedStopTimes = childStopTimes | ||
.concat() | ||
.sort(stopTimeComparator) | ||
.slice(0, getStopViewerConfig.numberOfDepartures) | ||
console.log(sortedStopTimes[0]) | ||
return sortedStopTimes[0] | ||
} | ||
|
||
render () { | ||
const { | ||
childStops, | ||
homeTimezone, | ||
stopViewerArriving, | ||
timeFormat | ||
} = this.props | ||
|
||
const showChildStops = childStops?.map(s => | ||
<div className='childstop__details'> | ||
{/* {s.stopTimes && this.getStopTime(s.stopTimes[0].times)} */} | ||
<div className='childstop__row1'> | ||
<span> | ||
{s.routes && s.routes[0].mode} | ||
</span> | ||
{s.name.charAt(0).toUpperCase()}{s.name.slice(1).toLowerCase()} | ||
<a href='/'>View Details</a> | ||
</div> | ||
<div className='childstop__row2'> | ||
<span className='childstop__route-short-name' style={{ border: '1px solid', borderRadius: '50%', padding: '3px' }}> | ||
{s.routes && s.routes[0].shortName} | ||
</span> | ||
<span> | ||
{s.routes && s.routes[0].longName} | ||
</span> | ||
{s.stopTimes && ( | ||
<div className='next-trip-preview'> | ||
<StopTimeCell | ||
homeTimezone={homeTimezone} | ||
soonText={stopViewerArriving} | ||
stopTime={this.getStopTime(s.stopTimes[0].times)} | ||
timeFormat={timeFormat} | ||
/> | ||
</div>)} | ||
</div> | ||
</div> | ||
) | ||
return ( | ||
<> | ||
<h3>Related Stops</h3> | ||
<ul>{showChildStops}</ul> | ||
</> | ||
) | ||
} | ||
} | ||
|
||
export default ChildStopDetails |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters