gusano / ember-google-maps

A lightweight, declarative, composable API for building ambitious map UIs in your Ember apps.

Home Page:https://ember-google-maps.sandydoo.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

πŸ“ Ember Google Maps

A lightweight, declarative, composable API for building ambitious map UIs in your Ember apps.

What this addon is:
  • βœ… A lightweight Ember API for working with Google Maps.
  • βœ… An on-demand, asynchronous loader for the Google Maps API.
What this addon is not:
  • ❌ A bulky, verbose wrapper that reimplements the entire Google Maps API.
  • ❌ A whitelist or option validator that is tightly coupled to Google's API.

πŸ“Ž Documentation

πŸ‘·β€ Maintainers

This addon is maintained by Sander Melnikov.

⭐ Features

Feature
Lightweight wrapper βœ…
Async API loading βœ…
Official Google API βœ…
Leverages templates βœ…
Contextual components βœ…
Minimal observer usage βœ…
Native Ember HTML markers βœ…

If you don't need the Google API specifically, check out ember-leaflet.

Examples of what to expect

Display a map centered around a set of coordinates πŸ—Ί.

{{g-map lat='51.508530' lng='-0.076132' zoom=10}}

Display an array of locations using markers πŸ“.

{{#g-map lat='51.508530' lng='-0.076132' zoom=10 as |g|}}
  {{#each locations as |l|}}
    {{g.marker lat=l.lat lng=l.lng onClick=(action 'showDetails' l)}}
  {{/each}}
{{/g-map}}

Display a custom overlay, like a custom HTML marker using template blocks 😱. This lets you do all sorts of fancy things, like adding CSS animations and binding data.

{{#g-map lat='51.508530' lng='-0.076132' zoom=10 as |g|}}
  {{#each rentals as |r|}}
    {{#g.overlay lat=r.lat lng=r.lng classNames='custom-marker'}}
      <div class="marker-content">
        <p class="price">{{r.price}}</p>
      </div>
    {{/g.overlay}}
  {{/each}}
{{/g-map}}

Contributing

Installation

  • git clone https://github.com/sandydoo/ember-google-maps.git this repository
  • cd ember-google-maps
  • yarn

Linting

  • yarn lint:js
  • yarn lint:js --fix

Setting up API keys

The dummy app and test suite is run using a live map instance, which means you need an API key. I do not provide API keys for testing – you need to generate your own.

You can create an API key by following the instructions here: Create API key.

Assign this key to the GOOGLE_MAPS_API_KEY variable in .env or just run these lines, making sure to replace INSERT_YOUR_KEY_HERE with your actual key.

touch .env & echo 'GOOGLE_MAPS_API_KEY=<INSERT_YOUR_KEY_HERE>' > .env cp .env .env.test

Running tests

  • ember test – Runs the test suite on the current Ember version
  • ember test --server – Runs the test suite in "watch mode"
  • ember try:each – Runs the test suite against multiple Ember versions

Running the dummy application

For more information on using ember-cli, visit https://ember-cli.com/.

License

MIT Β© Sander Melnikov.

About

A lightweight, declarative, composable API for building ambitious map UIs in your Ember apps.

https://ember-google-maps.sandydoo.me

License:MIT License


Languages

Language:JavaScript 64.0%Language:HTML 31.4%Language:CSS 4.5%Language:Shell 0.0%