Skip to content

Commit

Permalink
Merge pull request #244 from wri/feat/TM-905-create-map-instance
Browse files Browse the repository at this point in the history
[TM-905] Update map instance
  • Loading branch information
cesarLima1 authored Jun 10, 2024
2 parents ade2cc5 + 651e603 commit 01c4444
Show file tree
Hide file tree
Showing 29 changed files with 3,929 additions and 644 deletions.
2 changes: 1 addition & 1 deletion src/components/elements/Inputs/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const Input = forwardRef(
...inputProps
} = inputWrapperProps;
const id = useId();
const customVariantClasses = customVariant ? customVariant : {};
const customVariantClasses = customVariant ?? {};
const variantClasses = {
default: {
"px-3 py-[9px] rounded-lg focus:border-primary-500": true,
Expand Down
59 changes: 59 additions & 0 deletions src/components/elements/Map-mapbox/GeoJSON.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
export as namespace GeoJSON;
export type GeoJsonGeometryTypes = Geometry["type"];

export type GeoJsonTypes = GeoJSON["type"];

export type BBox = [number, number, number, number];

export type Position = number[];

export interface GeoJsonObject {
type: GeoJsonTypes;
bbox?: BBox | undefined;
}
export type GeoJSON = Geometry | Feature | FeatureCollection;
export type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection;
export type GeometryObject = Geometry;

export interface Point extends GeoJsonObject {
type: "Point";
coordinates: Position;
}

export interface MultiPoint extends GeoJsonObject {
type: "MultiPoint";
coordinates: Position[];
}

export interface LineString extends GeoJsonObject {
type: "LineString";
coordinates: Position[];
}

export interface MultiLineString extends GeoJsonObject {
type: "MultiLineString";
coordinates: Position[][];
}
export interface Polygon extends GeoJsonObject {
type: "Polygon";
coordinates: Position[][];
}

export interface MultiPolygon extends GeoJsonObject {
type: "MultiPolygon";
coordinates: Position[][][];
}

export type GeoJsonProperties = { [name: string]: unknown } | null;

export interface Feature<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
type: "Feature";
geometry: G;
id?: string | number | undefined;
properties: P;
}

export interface FeatureCollection<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
type: "FeatureCollection";
features: Array<Feature<G, P>>;
}
14 changes: 14 additions & 0 deletions src/components/elements/Map-mapbox/Map.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import mapboxgl, { FillLayer, LineLayer } from "mapbox-gl";

type LayerStyle = Pick<mapboxgl.Style, "metadata"> & (FillLayer | LineLayer);

export type LayerWithStyle = LayerStyle;

export interface LayerType {
name: string;
styles: LayerWithStyle[];
}

export type ControlType = Control | IControl;

export type TooltipType = "edit" | "goTo" | "view";
Loading

0 comments on commit 01c4444

Please sign in to comment.