Skip to content

Commit

Permalink
Merge branch 'master' of github.com:trynmaps/opentransit-map
Browse files Browse the repository at this point in the history
  • Loading branch information
mjrerle2 committed Jan 10, 2019
2 parents 24d6802 + 12cc6c4 commit 554f9ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/ControlPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,19 @@ class ControlPanel extends Component {
<div className="routes-header stops-toggle">
<h3>Stops</h3>
<Toggle
defaultChecked={this.state.showStops}
onChange={() => this.setState({ showStops: !this.state.showStops })}
defaultChecked
onChange={() => this.props.toggleStops()}
/>
</div>
<div className="routes-header">
<h3>Routes</h3>
</div>
<ul className="route-checkboxes">
<ul className="list-group">
{sortedRoutes.map(route => (
<Checkbox
route={route}
label={route.properties.name}
handleCheckboxChange={checkedRoute => this.props.filter(checkedRoute)}
handleCheckboxChange={checkedRoute => this.props.filterRoutes(checkedRoute)}
key={route.id}
/>
))}
Expand All @@ -105,7 +105,8 @@ class ControlPanel extends Component {

ControlPanel.propTypes = {
relay: propTypes.element.isRequired,
filter: propTypes.element.isRequired,
filterRoutes: propTypes.element.isRequired,
toggleStops: propTypes.element.isRequired,
};

export default ControlPanel;
7 changes: 6 additions & 1 deletion src/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class Map extends Component {
constructor() {
super();
this.filterRoutes = this.filterRoutes.bind(this);
this.toggleStops = this.toggleStops.bind(this);
this.state = {
// Viewport settings that is shared between mapbox and deck.gl
viewport: {
Expand Down Expand Up @@ -167,6 +168,10 @@ class Map extends Component {
this.setState({ geojson: newGeojson });
}

toggleStops() {
this.setState({ showStops: !this.state.showStops });
}

renderMap() {
const onViewportChange = viewport => this.setState({ viewport });
const { trynState } = this.props.trynState || {};
Expand Down Expand Up @@ -232,7 +237,7 @@ class Map extends Component {
{this.renderMap()}
</div>
<div className="col-sm-3 col-md-2 hidden-xs-down bg-faded sidebar">
<ControlPanel filter={this.filterRoutes} />
<ControlPanel filterRoutes={this.filterRoutes} toggleStops={this.toggleStops} />
</div>
</div>
</div>
Expand Down

0 comments on commit 554f9ab

Please sign in to comment.