Convert map card to Lit/TS (#2826)

* Convert map card to Lit/TS

* Address comments
This commit is contained in:
Paulus Schoutsen
2019-02-25 11:10:22 -08:00
committed by GitHub
parent 63e6506510
commit 90a1f7e51c
6 changed files with 431 additions and 379 deletions

View File

@@ -1,8 +1,13 @@
import { Map } from "leaflet";
// Sets up a Leaflet map on the provided DOM element
export const setupLeafletMap = async (mapElement) => {
export type LeafletModuleType = typeof import("leaflet");
export const setupLeafletMap = async (
mapElement
): Promise<[Map, LeafletModuleType]> => {
// tslint:disable-next-line
const Leaflet = (await import(/* webpackChunkName: "leaflet" */ "leaflet"))
.default;
const Leaflet = (await import(/* webpackChunkName: "leaflet" */ "leaflet")) as LeafletModuleType;
Leaflet.Icon.Default.imagePath = "/static/images/leaflet";
const map = Leaflet.map(mapElement);