Coder Social home page Coder Social logo

gustavorino / google-maps-input Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sanity-io/google-maps-input

0.0 0.0 0.0 866 KB

Sanity plugin providing input handlers for geo-related input types using Google Maps

License: MIT License

Shell 0.38% JavaScript 4.02% TypeScript 95.60%

google-maps-input's Introduction

@sanity/google-maps-input

T his is a Sanity Studio v3 plugin. For the v2 version, please refer to the v2-branch.

What is it?

Plugin for Sanity Studio providing input handlers for geo-related input types using Google Maps.

This plugin will replace the default geopoint input component.

Google maps input

Know issues in Studio V3

  • Diff-preview is not implemented.

These will be re-added well before Studio V3 GA.

Installation

In your studio folder, run:

npm install --save @sanity/google-maps-input

or

yarn add @sanity/google-maps-input

Usage

Add it as a plugin in sanity.config.ts (or .js), with a valid Google Maps API key:

import { googleMapsInput } from "@sanity/google-maps-input";

export default defineConfig({
  // ...
  plugins: [
      googleMapsInput({
          apiKey: "my-api-key"
     })
  ] 
})

Ensure that the key has access to:

  • Google Maps JavaScript API
  • Google Places API Web Service
  • Google Static Maps API

And that the key allows web-access from the Studio URL(s) you are using the plugin in.

Note: This plugin will replace the default geopoint input component.

Store selected Zoom

Optionally persists the selected zoom.

import {googleMapsInput} from '@sanity/google-maps-input'

export default defineConfig({
  // ...
  plugins: [
    googleMapsInput({
      saveZoom: true, // default false
      apiKey: 'my-api-key',
    }),
  ],
})

Adds a zoom property in geopoint object.

{
  "_type": "geopoint",
  "lat": 54.5259614,
  "lng": 15.2551187,
  "zoom": 3
}

Stuck? Get help

Slack Community Button

Join Sanity’s developer community or ping us on twitter.

License

MIT-licensed. See LICENSE.

Develop & test

This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.

See Testing a plugin in Sanity Studio on how to run this plugin with hotreload in the studio.

Release new version

Run "CI & Release" workflow. Make sure to select the main branch and check "Release new version".

google-maps-input's People

Contributors

snorrees avatar renovate[bot] avatar semantic-release-bot avatar stipsan avatar bjoerge avatar gustavorino avatar pierrenel 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.