0.3.0 • Published 10 months ago

@bruin-mbv/mapping-lib v0.3.0

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

Bruin Map Component

This project provides:

  • the BruinMap component that can be used in Bruin to display a set of
  • BruinMarkers for each location / site to be shown.

The types you should be aware of are:

export type BruinMarker = {
  markerId: number;
  position: google.maps.LatLngLiteral;
  title: string;
  displayValue: string;
  scale?: number;
  status?: SiteStatus;
  serviceStatus?: ServiceStatus;
};

export type BruinMarkerClickHandler = (markerId: number) => void;

export type MarkerStyle = "starlink" | "pin" | "serviceStatus";

export type ServiceStatus =
  | "Healthy"
  | "PartiallyDegraded"
  | "Degraded"
  | "Outage"
  | "Unknown";

export type SiteStatus = "Active" | "Offline" | "Flagged";

export type BruinMapProps = {
  /** The Google platform API key */
  apiKey: string;
  /** An array of markers to display on the map */
  markers: Array<BruinMarker>;
  /** Style of markers to use - Starlink | Pin */
  markerStyle?: MarkerStyle;
  /** Whether to show a toggle switch to change the map style */
  displayStyleToggle?: boolean;
  /** An optional string to display in the marker infowindow's action button */
  markerViewDetailsActionLabel?: string;
  /** Whether to set the map bounds to fit the markers */
  setBoundsToFitMarkers?: boolean;
  /** Whether to prevent the zoom and other map controls from being displayed */
  hideMapControls?: boolean;
  /** The initial zoom level to use for the map - which is ignored for single location satellite views*/
  initialZoom?: number;
  /** A callback function to handle marker details click */
  onMarkerDetailsClick?: BruinMarkerClickHandler;
};

Installation

  • Type pnpm add @bruin-mbv/mapping-lib in your project (or use your favorite package manager in place of pnpm)

Usage

You will need to provide a usable Google API key to the component - one that is tied to the map style that is used internally by the inner Google Map component.

Testing

You can run the package's tests using

  • pnpm test

Storybook Preview

On the local copy of this package project, you can view a preview of the BruinMap component by running:

  • pnpm storybook
0.3.0

10 months ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.2.15

11 months ago

0.2.14

11 months ago

0.2.13

11 months ago

0.2.12

1 year ago

0.2.11

1 year ago

0.2.10

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.7

1 year ago

0.1.16

1 year ago

0.2.6

1 year ago

0.1.17

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago