npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fusionworks/ra-google-maps-input

v0.1.7

Published

React-admin field/input to show markers on a map.

Downloads

41

Readme

@fusionworks/ra-google-maps-input

A simple map input for react-admin that uses react-google-maps to set & show points on map.

Install

Using npm: npm i @fusionworks/ra-google-maps-input

Using yarn: yarn add @fusionworks/ra-google-maps-input

Usage

import { Edit, SimpleForm, TextInput } from 'react-admin';
// import GMapInput component
import { GMapInput } from '@fusionworks/ra-google-maps-input';

// use GMapInput in Edit form
export const EntityEdit = props => (
  <Edit {...props}>
    <SimpleForm>
      <TextInput source="id" />
      <TextInput source="name" />
      <GMapInput
        source="coordinates"
        googleKey="<YOUR_GOOGLE_APP_KEY>"
      />
    </SimpleForm>
  </Edit>
);

You can also use that component to work also with multiple markers on map:

import { Edit, SimpleForm, TextInput } from 'react-admin';
// import GMapInput component
import { GMapInput } from '@fusionworks/ra-google-maps-input';

// use GMapInput in Edit form with "multipleMarkers" prop
export const EntityEdit = props => (
  <Edit {...props}>
    <SimpleForm>
      <TextInput source="id" />
      <TextInput source="name" />
      <GMapInput
        source="coordinates"
        multipleMarkers
        googleKey="<YOUR_GOOGLE_APP_KEY>"
      />
    </SimpleForm>
  </Edit>
);

That component provides a prop that allows to use a search input to search for a specific location on map, and to put a marker on that location

import { Edit, SimpleForm, TextInput } from 'react-admin';
// import GMapInput component
import { GMapInput } from '@fusionworks/ra-google-maps-input';

// use GMapInput in Edit form with "searchable" prop
export const EntityEdit = props => (
  <Edit {...props}>
    <SimpleForm>
      <TextInput source="id" />
      <TextInput source="name" />
      <GMapInput
        source="coordinates"
        searchable
        googleKey="<YOUR_GOOGLE_APP_KEY>"
      />
    </SimpleForm>
  </Edit>
);

Also, there exists an Field component, that can be used in Show Views


import { Show, SimpleShowLayout, TextField } from 'ra-google-maps-input';
/// import GMapField component
import { GMapField } from 'ra-google-maps-input';

// use GMapField component in show View
export const ShowEntity = props => (
  <Show {...props}>
    <SimpleShowLayout>
        <TextField source="id" />
        <TextField source="name" />
        <GMapField
          source="coordinates"
          googleKey="<YOUR_GOOGLE_APP_KEY>"
        />
    </SimpleShowLayout>
  </Show>
);

Props

|Prop|Type|Description|Default| |:---:|:---:|:---:|:---:| |googleKey|string|the google aplication key for your map| |source|string|source field in your resource model| |multipleMarkers|boolean|source field in your resource model|false| |searchable|boolean|adds a search input to your map|false|

For GMapField ar aveilable just source and googleKey props

Example

You can find an example of react-admin aplication that uses @fusionworks/ra-google-maps-input in /example directory of component github repository

To run this example you need to: clone the repository, navigate in example folder, install dependencies, and run the app.

  • git clone [email protected]:FusionWorks/react-admin-google-maps.git && cd react-admin-google-maps

  • cd example

  • npm i or yarn

  • npm start or yarn start