@anandaroop/yat
v1.0.9
Published
A silly geolocation component
Downloads
37
Readme
yat
Yat is a simple client-side geolocation React component, made mostly to tinker with publishing npm packages.
You don't have to be a yat to use it.
Installation
yarn add @anandaroop/yat
Basic Usage
In your html:
<div id="root">
<!-- component will mount here -->
</div>
In your javascript:
import React from 'react'
import ReactDOM from 'react-dom'
import Yat from '@anandaroop/yatyat'
ReactDOM.render(
<Yat />,
document.querySelector('#root')
)
Resulting in the html output:
-74.9938, 39.8526
Options
Let's support both lon,lat and lat,lon ordering.
import React from 'react'
import Yat from '@anandaroop/yatyat'
MyComponent = () =>
<div>
<p>Here's lon,lat ordering (the default)</p>
<Yat order="lon,lat" />
<p>Here's lat,lon ordering</p>
<Yat order="lat,lon" />
</div>
Development
Component source code lives under /src/components
.
Implementations, specs and stories are all co-located under each component directory.
src/components/
└── Yat
├── __snapshots__
├── index.js
├── spec.js
└── stories.js
Testing
Use Jest for behavior and snapshot testing
$ yarn test
Stories
Use Storybook for a nice developer experience, and to document
$ yarn run storybook
$ open http://localhost:6006