8 changed files with 81 additions and 125 deletions
@ -1,9 +1,7 @@ |
|||
import type React from "react" |
|||
import type React from "react"; |
|||
|
|||
import { Pane } from "evergreen-ui" |
|||
import { Pane } from "evergreen-ui"; |
|||
|
|||
export const HelpDialog = (): JSX.Element => { |
|||
return ( |
|||
<Pane></Pane> |
|||
) |
|||
} |
|||
return <Pane></Pane>; |
|||
}; |
|||
|
|||
@ -1,32 +0,0 @@ |
|||
import type React from "react"; |
|||
import { useEffect, useState } from "react"; |
|||
|
|||
import { Map, MapOptions } from "maplibre-gl"; |
|||
|
|||
export interface useMapboxProps { |
|||
ref: React.RefObject<HTMLDivElement>; |
|||
style: string; |
|||
options?: Partial<MapOptions>; |
|||
} |
|||
|
|||
export function useCreateMapbox({ |
|||
ref, |
|||
style, |
|||
options, |
|||
}: useMapboxProps): Map | undefined { |
|||
const [mapInstance, setMapInstance] = useState<Map>(); |
|||
useEffect(() => { |
|||
const container = ref.current as HTMLDivElement; |
|||
if (mapInstance || !container) { |
|||
return; |
|||
} |
|||
const map = new Map({ |
|||
container, |
|||
style, |
|||
...options, |
|||
}); |
|||
setMapInstance(map); |
|||
}, []); |
|||
|
|||
return mapInstance; |
|||
} |
|||
@ -1,14 +0,0 @@ |
|||
import { createContext, useContext } from "react"; |
|||
|
|||
import type { Map } from "maplibre-gl"; |
|||
|
|||
export interface MapContextValue { |
|||
ref: React.Ref<HTMLDivElement>; |
|||
map?: Map; |
|||
} |
|||
|
|||
export const MapContext = createContext<MapContextValue>({} as MapContextValue); |
|||
|
|||
export const useMap = (): MapContextValue => { |
|||
return useContext(MapContext); |
|||
}; |
|||
Loading…
Reference in new issue