Giter Site home page Giter Site logo

edgeworkscreative / ewc-google-map Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 175 KB

:round_pushpin: Google Maps Place card web component built with StencilJS.

Home Page: https://www.npmjs.com/package/@edgeworkscreative/ewc-google-map

License: MIT License

CSS 21.69% TypeScript 73.58% HTML 4.73%
google-maps stencil stenciljs web-components google-places snazzy-maps

ewc-google-map's Introduction

Built With Stencil

Edgeworks Creative - Google Maps Component

Google Maps Place card web component built with StencilJS.

So simple, it works with only two lines of code! JSFiddle

WIP

Preview

Stencil components are just Web Components, so they work in any major framework or with no framework at all.

Example

<ewc-google-map 
  place-id="ChIJc0ONLheftUwR2eRUIlyCAF4" 
  zoom="16" 
  snazzy-map="https://snazzymaps.com/style/228639/dark-tan" 
  key="GOOGLE-MAPS-API-KEY"></ewc-google-map>

Features

  • Load styles directly from SnazzyMaps (Please cache this request in your service worker)
  • Easily retrieve business contact information by passing your Google Place ID.
  • Slide through all of your Google Place photos.

FAQ

  • How do I find my Google Place ID?
    • You can use the map located here to find your Place ID.
  • Do I need a Google Maps API key?
    • You do not need a key when developing locally.
  • Where do I find my Google Maps API key?
    • You can follow these steps.
  • I'd like to use the SnazzyMaps feature, what should I add to my service worker?
    • If you're using Workbox:
    workbox.routing.registerRoute(
      new RegExp('^https://cors-anywhere.herokuapp.com/https://snazzymaps.com/'),
      workbox.strategies.cacheFirst({
        cacheName: 'snazzy-maps',
        plugins: [
          new workbox.cacheableResponse.Plugin({
            statuses: [0, 200]
          }),
        ],
      }),
    );

Using this component

Script tag

  • Put a script tag similar to this <script src='https://unpkg.com/@edgeworkscreative/ewc-google-map@latest/dist/ewc.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

Node Modules

  • Run npm install @edgeworkscreative/ewc-google-map --save
  • Put a script tag similar to this <script src='node_modules/@edgeworkscreative/ewc-google-map/dist/ewc.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

In a stencil-starter app

  • Run npm install @edgeworkscreative/ewc-google-map --save
  • Add an import to the npm packages import '@edgeworkscreative/ewc-google-map';
  • Then you can use the element anywhere in your template, JSX, html etc

TODO

  • Documentation
  • Add styles prop as alternative to fetching directly from SnazzyMaps

Stencil

Stencil is a compiler for building fast web apps using Web Components.

Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements v1 spec.

ewc-google-map's People

Contributors

adamlacombe avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

ewc-google-map's Issues

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.