Skip to content

Commit

Permalink
♻️ Fix map display
Browse files Browse the repository at this point in the history
  • Loading branch information
mcampourcy committed Jan 8, 2024
1 parent 464f440 commit e745ca7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
7 changes: 3 additions & 4 deletions src/components/NextMeetup/Place/Icon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { withPrefix } from 'gatsby'
import L from 'leaflet'

const iconNantesJS = {
export const iconNantesJS = L.icon({
iconUrl: withPrefix('/images/logotype.png'),
iconRetinaUrl: null,
iconAnchor: null,
Expand All @@ -10,6 +11,4 @@ const iconNantesJS = {
shadowAnchor: null,
iconSize: [50,50],
className: 'marker'
}

export { iconNantesJS }
})
21 changes: 11 additions & 10 deletions src/components/NextMeetup/Place/Place.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import React from 'react'
import { number } from 'prop-types'
import { string, number } from 'prop-types'
import { FullWidthContainer } from '../../FullWidthContainer'
import { MapContainer, Marker, Popup, TileLayer } from 'react-leaflet'
import { iconNantesJS } from './Icon'
import L from 'leaflet'

import * as styles from './Place.module.css'

Place.propTypes = {
latitude: number,
longitude: number,
name: String,
link: String,
address: String,
name: string,
link: string,
address: string,
postal_code: number,
city: String,
city: string,

}

Expand All @@ -28,9 +27,10 @@ export function Place ({
city
}) {
const GATSBY_MAPBOX_TOKEN = process.env.GATSBY_MAPBOX_TOKEN

if (!latitude || !longitude || !GATSBY_MAPBOX_TOKEN) return null
const position = [latitude, longitude]
console.log({position})

return (
<FullWidthContainer className={styles.place}>
<div className={styles.place__map}>
Expand All @@ -39,8 +39,8 @@ export function Place ({
zoom={15}
className={styles.leaflet_container}
scrollWheelZoom={false}
dragging={!L.Browser.mobile}
tap={!L.Browser.mobile}>
dragging={true}
tap={true}>
<TileLayer
attribution="&amp;copy
<a href=&quot;http://osm.org/copyright&quot;>OpenStreetMap</a>
Expand All @@ -52,7 +52,8 @@ export function Place ({
/>
<Marker
position={position}
icon={new L.Icon(iconNantesJS)}>
icon={iconNantesJS}
>
<Popup>
<div className={styles.popup}>
<b><a href={link}>{name}</a></b><br />
Expand Down

0 comments on commit e745ca7

Please sign in to comment.