-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathgeocoder.js
56 lines (53 loc) · 1.33 KB
/
geocoder.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React, {Component, PropTypes} from 'react'
import Modal from 'react-modal'
import Geocoder from 'react-select-geocoder'
const latlngShape = {
lat: PropTypes.number,
lng: PropTypes.number
}
export default class Geo extends Component {
static propTypes = {
maxLatlng: PropTypes.shape(latlngShape),
minLatlng: PropTypes.shape(latlngShape),
onChange: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired
}
render () {
const {maxLatlng, minLatlng, onChange, onClose} = this.props
return (
<Modal
isOpen
onRequestClose={onClose}
style={{
overlay: {
zIndex: 2500,
backgroundColor: 'rgba(255, 255, 255, 0.5)'
},
content: {
background: 'transparent',
border: 'none',
position: 'static',
marginTop: '40px',
marginLeft: 'auto',
marginRight: 'auto',
height: '300px',
width: '500px'
}
}}
>
<Geocoder
apiKey={process.env.MAPZEN_SEARCH_KEY}
autofocus
boundary={{
rect: {
maxLatlng,
minLatlng
}
}}
onChange={onChange}
placeholder='Search for an address...'
/>
</Modal>
)
}
}