Giter Club home page Giter Club logo

react-hotels-on-map's Introduction

Build Status

Summary

Presents a set of hotels as clustered markers on Google Map, each with an info window displaying the hotel summary. That's a very simple, narrowly specialized component, tailored for hotels. If you need something more general, take a look at react-google-maps. Yet another difference from react-google-maps is the React 0.13 support: react-google-maps v4+, which is capable of clustering map markers, requires React 0.14.

Usage

import React from 'react';
import HotelsOnMap from 'hotels-on-map';

const props = {hotels: [{
    ratingStars: 5,
    name: 'Hôtel InterContinental Genève',
    streetAddress: 'Chemin du Petit-Saconnex 7-9',
    postalCode: '1209',
    cityLocalized: 'Genève',
    geolocation: {latitude: 46.22425, longitude: 6.132383}
}, {
    ratingStars: 3,
    name: 'Hôtel Eden',
    streetAddress: 'Rue de Lausanne 135',
    postalCode: '1202',
    cityLocalized: 'Genève',
    geolocation: {latitude: 46.221928, longitude: 6.148965}
}/* ... */]};

React.render(
    <HotelsOnMap {...props}/>,
    global.document.getElementById('root')
);

The code above will display and cluster all the hotel markers on the map, making sure that all the clustered markers are visible. On a marker click, an info-window with the short hotel information will be displayed.

You're encouraged to also set the markerClusterImageUrlPrefix prop value, and host the cluster images on your own Web property. The default value is https://www.swisshotels.com/client-side-public/img/markerclustererplus/m, giving you those:

One hotel case

When the length of the hotels array is 1, an info window for the single hotel is displayed immediately, saving the user a marker click.

Demo

See the short example code with that sample data running live here.

react-hotels-on-map's People

Contributors

ikr avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.