|
|
@ -2,7 +2,8 @@ import { useRef } from 'preact/hooks'; |
|
|
|
import { type MapViewParameters, useMap } from '../hooks/leaflet/useMap'; |
|
|
|
import { type MapViewParameters, useMap } from '../hooks/leaflet/useMap'; |
|
|
|
import { useMapClick } from '../hooks/leaflet/useMapClick'; |
|
|
|
import { useMapClick } from '../hooks/leaflet/useMapClick'; |
|
|
|
import { useMarkersOnMap } from './hooks/useMarkersOnMap'; |
|
|
|
import { useMarkersOnMap } from './hooks/useMarkersOnMap'; |
|
|
|
import type { MapProps } from './types'; |
|
|
|
import type { Coordinates } from '../shared/types'; |
|
|
|
|
|
|
|
import type { Marker } from './types'; |
|
|
|
|
|
|
|
|
|
|
|
const defaultMapViewParameters: MapViewParameters = [[47.42111, 10.98528], 13]; |
|
|
|
const defaultMapViewParameters: MapViewParameters = [[47.42111, 10.98528], 13]; |
|
|
|
|
|
|
|
|
|
|
@ -13,6 +14,11 @@ const markerLayersStyle = { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type MapProps = { |
|
|
|
|
|
|
|
markers: Marker[]; |
|
|
|
|
|
|
|
onMapClick: (coordinates: Coordinates) => void; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export const MapComponent = ({ markers, onMapClick }: MapProps) => { |
|
|
|
export const MapComponent = ({ markers, onMapClick }: MapProps) => { |
|
|
|
const mapContainerRef = useRef<HTMLDivElement>(null); |
|
|
|
const mapContainerRef = useRef<HTMLDivElement>(null); |
|
|
|
const mapRef = useMap(mapContainerRef, defaultMapViewParameters); |
|
|
|
const mapRef = useMap(mapContainerRef, defaultMapViewParameters); |
|
|
|