1.2.0 • Published 3 months ago

@bradtech/map v1.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

Map Component

React Map Component created for Brad Technology web apps.

Supports both Google Map and MapBox.

Getting started

npm i @bradtech/map

OR

yarn add @bradtech/map

Map props

NameTypeDefaultDescription
widthstring'600px'Map width
heightstring'600px'Map height
display'block' | 'inline'''CSS display property
center{latitude: number; longitude: number}{latitude: 0; longitude: 0}Default location
zoomnumber12Default zoom level
markerList{latitude: number; longitude: number}[][]List containing the markers the map will display
kmlListstring[][]List containing KML codes to display KML layers
apiKeystringnullGoogle Map or MapBox API key
decoratorGoogleMapDecorator | MapBoxDecoratorGoogleMapDecoratorComponent that will be used to display the map

Examples

Display a basic map

import React from 'react'
import { Map } from '@bradtech/map'

export default class App extends React.Component {
   constructor(props) {
      super(props)
   }

   render() {
      return (
         <Map
            width="100%"
            zoom={6}
            center={{ latitude: 43.932658, longitude: 4.821883 }}
            apiKey={'GOOGLE_MAP_API_KEY'}
         />
      )
   }
}

Display a map using MapBox

import React from 'react'
import { Map, MapBoxDecorator } from '@bradtech/map'

export default class App extends React.Component {
   constructor(props) {
      super(props)
   }

   render() {
      return (
         <Map
            width="100%"
            zoom={6}
            center={{ latitude: 43.932658, longitude: 4.821883 }}
            decorator={MapBoxDecorator}
            apiKey={'MAPBOX_API_KEY'}
         />
      )
   }
}

Display markers

import React from 'react'
import { Ma } from '@bradtech/map'

export default class App extends React.Component {
   constructor(props) {
      super(props)

      this.markerList = [
         { longitude: -110.65264890901744, latitude: 44.59255346806212 },
      ]
   }

   render() {
      return (
         <Map
            width="100%"
            zoom={6}
            markerList={this.markerList}
            apiKey={'GOOGLE_MAP_API_KEY'}
         />
      )
   }
}

License

MIT

1.2.0

3 months ago

1.1.2

4 months ago

1.1.1

4 months ago

1.1.0

4 months ago

1.0.25

8 months ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.11

2 years ago

1.0.12

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago