Activities: map init
This commit is contained in:
@ -16,11 +16,12 @@
|
||||
integrity="sha256-MGU/JUq/40CFrfxjXb5pZjpoZmxiP2KuICN5ElLFNd8="
|
||||
crossorigin="anonymous"
|
||||
>
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/foundation-icons/3.0/foundation-icons.min.css"
|
||||
>
|
||||
href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css"
|
||||
integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ=="
|
||||
crossorigin=""/>
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" />
|
||||
<title>mpwo</title>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -2,6 +2,7 @@ import React from 'react'
|
||||
import { Helmet } from 'react-helmet'
|
||||
import { connect } from 'react-redux'
|
||||
|
||||
import ActivityMap from './ActivityMap'
|
||||
import { getData } from '../../actions/index'
|
||||
|
||||
class ActivityDisplay extends React.Component {
|
||||
@ -72,7 +73,7 @@ class ActivityDisplay extends React.Component {
|
||||
Map
|
||||
</div>
|
||||
<div className="card-body">
|
||||
to do
|
||||
<ActivityMap />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
30
mpwo_client/src/components/Activities/ActivityMap.jsx
Normal file
30
mpwo_client/src/components/Activities/ActivityMap.jsx
Normal file
@ -0,0 +1,30 @@
|
||||
import React from 'react'
|
||||
import { Map, TileLayer } from 'react-leaflet'
|
||||
|
||||
import { thunderforestApiKey } from '../../utils'
|
||||
|
||||
export default class ActivityMap extends React.Component {
|
||||
|
||||
constructor(props, context) {
|
||||
super(props, context)
|
||||
this.state = {
|
||||
lat: 51.505,
|
||||
lng: -0.09,
|
||||
zoom: 13,
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const position = [this.state.lat, this.state.lng]
|
||||
return (
|
||||
<Map center={position} zoom={this.state.zoom}>
|
||||
<TileLayer
|
||||
// eslint-disable-next-line max-len
|
||||
attribution='© <a href="http://www.thunderforest.com/">Thunderforest</a>, © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
url="https://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png"
|
||||
apikey={thunderforestApiKey}
|
||||
/>
|
||||
</Map>
|
||||
)
|
||||
}
|
||||
}
|
@ -60,3 +60,7 @@ input, textarea {
|
||||
.add-activity {
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.leaflet-container {
|
||||
height: 240px;
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
export const apiUrl = `${process.env.REACT_APP_API_URL}/api/`
|
||||
export const thunderforestApiKey = `${
|
||||
process.env.REACT_APP_THUNDERFOREST_API_KEY
|
||||
}`
|
||||
|
||||
export const isLoggedIn = () => !!window.localStorage.authToken
|
||||
|
||||
|
Reference in New Issue
Block a user