@s-ui/react-map-basic

1.55.0 • Public • Published

MapBasic

Description A map component inspired and rebuilded form Fotocasa map component. Includes, polygons, poi's, markers and different layer views.

Installation

$ npm install @s-ui/react-map-basic --save

Usage

Basic usage

Let's suppose that you wan't a map with an interactive behavior, what properties should you need?

import MapBasic from '@s-ui/react-map-basic'

return (<MapBasic
        appId="<HERE APP_ID>"
        appCode="<HERE APP_CODE>"
        id="test-map"
        height="100%"
        center={[41.493743, 2.075211]}
        zoom={17}
/>)

NON interactable maps

By default, all the maps have the 'draggable' leaflet flag setted to true. But what about if I want to disable it? Just pass isInteractable={false}

import MapBasic from '@schibstedspain/sui-map-basic'

return (<MapBasic
        appId="<HERE APP_ID>"
        appCode="<HERE APP_CODE>"
        isInteractable={false}
        center={[41.493743, 2.075211]}
        zoom={17}
        />)

Add Markers

What about put a marker on our map?

Markers are setted as "icons" prop. Icons is an array composed by: - Path to the image (local or not) - Size(width, height) array. - Anchor. This is the amount of pixels that will be deleted from the top or left of our image [0, 27] means margin-left: 0, margin-top: -27px - lat - long

import MapBasic from '@schibstedspain/sui-map-basic'

return (<MapBasic
        appId={"<HERE APP_ID>"}
        appCode={"<HERE APP_CODE>"}
        icons={[
            {
                iconUrl: 'http://www.pngall.com/wp-content/uploads/2017/05/Map-Marker-PNG-Pic.png',
                size: [18],
                anchor: [0, 27],
                lat: 41.568782,
                lng: 2.026029
             }
        ]}
/>)

If you want two markers you can add more elements to your icons array:

   icons={[
               {
                   iconUrl: 'http://www.pngall.com/wp-content/uploads/2017/05/Map-Marker-PNG-Pic.png',
                   size: [18],
                   anchor: [0, 27],
                   lat: 41.568782,
                   lng: 2.026029
                },
                {
                   iconUrl: 'http://www.pngall.com/wp-content/uploads/2017/05/Map-Marker-PNG-Pic.png',
                   size: [18],
                   anchor: [0, 27],
                   lat: 41.568782,
                   lng: 2.026029
                }
   ]}

Usage with Points of interest

If you wan't to add 'points of interest' to your map you could pass it as a pois array. This feature is attached to FC and need to be modified to be more generic.

    pois=[
    {[{"latitude":"42.67967","longitude":"-2.9674","hasPopup":false,"xitiTag":false,"propertyInfo":{"IsFavorite":false,"IsFullAddressVisible":false,"purchaseTypeId":2,"bti":0,"contact":"","highlighted":"false","on":0,"price":"","promotionId":"0","propertyId":"144830788"},"markerType":0,"isSelected":false,"Id":"144830788"}]}
    ]

Readme

Keywords

none

Package Sidebar

Install

npm i @s-ui/react-map-basic

Weekly Downloads

615

Version

1.55.0

License

MIT

Unpacked Size

160 kB

Total Files

23

Last publish

Collaborators

  • alejandro.ferrante
  • ivanmlaborda
  • salvador.juan
  • andresin87.adevinta
  • izeller
  • gfabregoadv
  • a.ferrer
  • ignacio_navarro
  • oscar_ramirez
  • jordi.munoz
  • joanleon-adv
  • aitor.rodriguez
  • luis-garrido
  • jenifer.lopez
  • isabelgomez87
  • pa.chruscinski.ext
  • schibstedspain
  • alfredo.arronte
  • belen.santos
  • xavi_ballestar
  • ferrangbtw
  • jamile.radloff
  • davidmartin2108
  • sergi.quintela
  • estefania_garcia
  • carlosvillu-adevinta
  • miriam-gil
  • arnau.guell
  • ferran.simon
  • victor.perez.adevinta
  • mariapaula.forero.ext
  • oscar.gomez
  • david.nieto
  • oriol.puig
  • nacho_torrella
  • xavi.murcia
  • ignacio.rodriguez
  • francisco.ruiz.lloret
  • sziauberyte
  • alfredo.zimperz
  • andresadv
  • javiauso
  • alverd004
  • marian.lucaci
  • pablogs
  • alisa_bayanova
  • cristhianb
  • sergiocollado
  • pablo.rey-adevinta
  • beatrizip
  • alex.castells
  • david.cuadrado.ext
  • giovanny.sayas.ext
  • patricio.sartore
  • azahara
  • marc.benito
  • sergio.escano
  • cristina.rodriguez.duque
  • pol.valls
  • frandelacasa-adevinta
  • carolina.mallo.ext
  • daniel.perez.ext
  • hpintos_adevinta
  • carlos.gonzalezl
  • albert.peiro
  • oscar-raig-adevinta
  • thomas.page.ext
  • sebastian.badea.adevinta
  • victoria.pasichnyk.ext
  • sendami.luque.ext
  • luz_adv
  • alfredo.narvaez
  • ruben-martin
  • dann41
  • emiliovz
  • adria.velardos
  • arturo.vicente
  • diegomr
  • sergi.martinez.adevinta
  • guillemgc3
  • frontend-jobs
  • javiermiguel
  • atilioscolaroadv
  • crotundu.adevinta
  • candymd
  • florinz
  • denis_z
  • anya_ok