Remove unused code.
This commit is contained in:
@@ -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);
|
||||
};
|
||||
Reference in New Issue
Block a user