Skip to content

Commit

Permalink
fix(ContextMenuDemo): Address prop validation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
binh-dam-ibigroup committed Feb 20, 2020
1 parent b58a255 commit 45fdabf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions packages/base-map/__mocks__/ContextMenuDemo.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
/* eslint-disable react/prop-types */
import React, { Component } from "react";
import BaseMap from "..";

const center = [45.522862, -122.667837];

export default class ContextMenuDemo extends Component {
constructor() {
super();

this.state = { location: null };
this.state = { location: center, contents: "" };
}

handleContextMenu = e => {
this.setState({ location: [e.latlng.lat, e.latlng.lng] });
this.setState({
location: [e.latlng.lat, e.latlng.lng],
contents: <h1>Context Popup</h1>
});
};

render() {
const { location } = this.state;
const center = [45.522862, -122.667837];
const { location, contents } = this.state;

return (
<div>
<BaseMap
center={center}
popup={{ location, contents: <h1>Context Menu</h1> }}
popup={{ location, contents }}
onContextMenu={this.handleContextMenu}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/base-map/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import { LayersControl, Map, Popup, TileLayer } from "react-leaflet";
import { latlngType } from "@opentripplanner/core-utils/lib/types";
import { latlngType } from "@opentripplanner/core-utils/src/types";
import L from "leaflet";

import callIfValid from "./util";
Expand Down

0 comments on commit 45fdabf

Please sign in to comment.