@neshan-maps-platform/react-openlayers
Version:
A react map component wrapping neshan openlayers map.
46 lines (45 loc) • 1.23 kB
TypeScript
import { Map } from "@neshan-maps-platform/ol";
import { MapOptions as MainMapOptions } from "@neshan-maps-platform/ol/Map";
import { MapType } from "@neshan-maps-platform/ol/Map";
import React from "react";
export interface BaseMapOptions extends MainMapOptions {
mapType?: MapType;
poi?: boolean;
traffic?: boolean;
}
interface MapOptionsWithKey extends BaseMapOptions {
key: string;
}
type MapOptionsUnion = {
options?: BaseMapOptions;
mapKey: string;
} | {
options: MapOptionsWithKey;
mapKey?: undefined;
};
export interface BaseMapProps {
zoom?: number;
center?: CoordsObj;
scale?: number;
defaultType?: MapType;
poi?: boolean;
traffic?: boolean;
onInit?: (map: Map) => void;
className?: React.HTMLAttributes<HTMLDivElement>["className"];
style?: React.HtmlHTMLAttributes<HTMLDivElement>["style"];
}
export type MapProps = BaseMapProps & MapOptionsUnion;
export interface NeshanMapRef {
mapContainer: React.RefObject<HTMLDivElement | null>;
map: Map | null;
isInitiated: boolean;
}
export declare interface CoordsObj {
latitude: number;
longitude: number;
}
export declare interface Tile {
title: MapType;
url: string;
}
export {};