-
Notifications
You must be signed in to change notification settings - Fork 66
v2.0 🎉 🎉 🎉 #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AnatoleLucet
wants to merge
23
commits into
master
Choose a base branch
from
feat/v2.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
v2.0 🎉 🎉 🎉 #130
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
18a7a9a
chore: cleanup before v2
AnatoleLucet e403f10
chore: init toolchain
AnatoleLucet fd66d66
feat: add GMap & GMapMarker components
AnatoleLucet 344c709
feat: add GMapAnimmatedMarker component
AnatoleLucet d578aaa
chore: rename package
AnatoleLucet 02ed021
chore: add .npmignore
AnatoleLucet 376850c
feat: add GMapsPolyline and GMapsAnimatedPolyline (#1)
AnatoleLucet 3b4a8ec
feat: add GMapsPolygon and GMapsAnimatedPolygon
AnatoleLucet d7e7663
docs: add list of TODOs
AnatoleLucet 1c51f90
chore: fill package.json info
AnatoleLucet b95952d
feat(animations): add more easing functions
AnatoleLucet 9991622
refactor: rename 'shenanigan' lib to 'utils'
AnatoleLucet 33a3e77
docs(components): add docs for every components
AnatoleLucet 003f4c2
docs(animated components): add screen captures
AnatoleLucet 18e40fb
chore(ci): add build/lint/test jobs
AnatoleLucet 124d51d
feat(animation): add shape interpolation & lots of tests
AnatoleLucet 60b30c0
chore: update lockfile
AnatoleLucet 5843c11
chore(toolchain): add eslint
AnatoleLucet 9dc827b
fix: typos and minor issues
AnatoleLucet 8846f67
docs: document hooks and contributing.md
AnatoleLucet 15d1971
docs: fix typos
AnatoleLucet b2afcde
chore: format code & variables names
AnatoleLucet 7be910a
chore(contributing.md): add '.env' instructions
AnatoleLucet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Fill in these values and rename this file to .env | ||
| # Then you can run any example in the `examples/` folder with `cd examples/<name> && pnpm dev` | ||
| API_KEY= | ||
| MAP_ID= | ||
AnatoleLucet marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| node_modules/ | ||
| examples/ | ||
| dist/ |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| module.exports = { | ||
| root: true, | ||
| env: { browser: true, node: true }, | ||
| parser: "@typescript-eslint/parser", | ||
| extends: [ | ||
| "prettier", | ||
| "eslint:recommended", | ||
| "plugin:@typescript-eslint/recommended", | ||
| ], | ||
| plugins: ["@typescript-eslint", "prettier"], | ||
| rules: { | ||
| "@typescript-eslint/no-explicit-any": "off", | ||
| "@typescript-eslint/no-empty-function": "off", | ||
| "@typescript-eslint/no-namespace": "off", | ||
| "prettier/prettier": "error", | ||
| "no-duplicate-imports": "error", | ||
| "@typescript-eslint/ban-ts-comment": "error", | ||
| "@typescript-eslint/no-unused-vars": [ | ||
| "error", | ||
| { | ||
| argsIgnorePattern: "^_", | ||
| varsIgnorePattern: "^_", | ||
| caughtErrorsIgnorePattern: "^_", | ||
| }, | ||
| ], | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| Build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - uses: pnpm/action-setup@v2.0.1 | ||
| with: | ||
| version: 8 | ||
| - uses: actions/setup-node@v2 | ||
| with: | ||
| node-version: 16.x | ||
| cache: pnpm | ||
| - run: pnpm install --frozen-lockfile | ||
| - run: pnpm build | ||
|
|
||
| Lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - uses: pnpm/action-setup@v2.0.1 | ||
| with: | ||
| version: 8 | ||
| - uses: actions/setup-node@v2 | ||
| with: | ||
| node-version: 16.x | ||
| cache: pnpm | ||
| - run: pnpm install --frozen-lockfile | ||
| - run: pnpm build | ||
| - run: pnpm lint | ||
| - run: pnpm check | ||
|
|
||
| Test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - run: git config --global core.autocrlf false | ||
| - uses: actions/checkout@v2 | ||
| - uses: pnpm/action-setup@v2.0.1 | ||
| with: | ||
| version: 8 | ||
| - uses: actions/setup-node@v2 | ||
| with: | ||
| node-version: 16.x | ||
| cache: pnpm | ||
| - run: pnpm install --frozen-lockfile | ||
| - run: pnpm build | ||
| - run: pnpm test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,17 @@ | ||
| demo/build.js | ||
| node_modules/ | ||
| # MacOS | ||
| .DS_Store | ||
|
|
||
| # NodeJS | ||
| node_modules | ||
| .pnpm-store | ||
|
|
||
| # IDEs | ||
| .idea | ||
| .vscode | ||
| .fleet | ||
|
|
||
| # Build output | ||
| dist | ||
|
|
||
| # Env vars | ||
| .env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,22 @@ | ||
| demo/ | ||
| src/ | ||
| .babelrc | ||
| Procfile | ||
| server.js | ||
| # MacOS | ||
| .DS_Store | ||
|
|
||
| # NodeJS | ||
| node_modules | ||
| .pnpm-store | ||
|
|
||
| # IDEs | ||
| .idea | ||
| .vscode | ||
| .fleet | ||
|
|
||
| # config files | ||
| /*.js | ||
| /*.mjs | ||
| /*.cjs | ||
| /*.ts | ||
| /tsconfig.json | ||
|
|
||
| # source | ||
| /src/ | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export default { | ||
| arrowParens: "avoid", | ||
| trailingComma: "all", | ||
| bracketSpacing: true, | ||
| singleQuote: false, | ||
| semi: true, | ||
| tabWidth: 2, | ||
| }; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Contributing | ||
|
|
||
| ## Working on React GMaps | ||
|
|
||
| ### Install | ||
|
|
||
| Requirements: | ||
|
|
||
| - node | ||
| - pnpm | ||
|
|
||
| You can install the dependencies with the following: | ||
|
|
||
| ```bash | ||
| pnpm install | ||
| ``` | ||
|
|
||
| Then you can start the build toolchain with: | ||
|
|
||
| ```bash | ||
| pnpm dev | ||
| ``` | ||
|
|
||
| ### Live preview | ||
|
|
||
| The easiest way to see a live preview of the changes you make, is to link your local version of react-gmaps to an example. | ||
|
|
||
| ```bash | ||
| # cd in an appropriate example | ||
| cd examples/<folder> | ||
| # install the example dependencies | ||
| pnpm install | ||
| # link your local version of react-gmaps to the example | ||
| pnpm link ../.. | ||
| # start the example | ||
| pnpm dev | ||
| ``` | ||
|
|
||
| Now any change you make in the React GMaps codebase will be reflected in the example project you started. | ||
|
|
||
| ## Opening a new Pull Request | ||
|
|
||
| Once your ready to get your changes reviewed and merged, you can create a [Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). | ||
|
|
||
| Before asking for a review, make sure to: | ||
|
|
||
| - Write a description of what you've changed and why. | ||
| - Link any related issue. | ||
| - Include a test that fails without your changes. | ||
| - Make sure the CI does not fail. |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,101 +1,65 @@ | ||
| [](https://travis-ci.org/MicheleBertoli/react-gmaps) | ||
| <h1 align="center">React GMaps</h1> | ||
|
|
||
| <h4 align="center">A modern Google Maps integration for ReactJS.</h4> | ||
|
|
||
| --- | ||
|
|
||
| | Marker | Polyline | Polygon | | ||
| | ------------------------------------- | --------------------------------------- | -------------------------------------- | | ||
| |  |  |  | | ||
|
|
||
| ```jsx | ||
| const location = { lat: 40.73061, lng: -73.935242 }; | ||
|
|
||
| function MyMarker() { | ||
| return ( | ||
| <GMapsMarker location={location}> | ||
| <p style={{ backgroundColor: "red" }}>Hello World</p> | ||
| </GMapsMarker> | ||
| ); | ||
| } | ||
|
|
||
| function MyMap() { | ||
| return ( | ||
| <div style={{ height: "100vh" }}> | ||
| <GMaps center={location} zoom={12}> | ||
| <MyMarker /> | ||
| </GMaps> | ||
| </div> | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| React Gmaps | ||
| =========== | ||
| ## Features | ||
|
|
||
| A [Google Maps](https://developers.google.com/maps/documentation/javascript/) component for [React.js](http://facebook.github.io/react/) | ||
| - Marker, Polyline, Polygon components and more | ||
| - Hook based | ||
AnatoleLucet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - Highly extensible | ||
| - Interpolation animations for everything (markers, polygons, etc.) | ||
|
|
||
| Features | ||
| -------- | ||
| ## Documentation | ||
|
|
||
| - Lazy Google Maps loading | ||
| - Easy to use | ||
| [See our documentation](/docs/index.md) | ||
|
|
||
| Installation | ||
| ------------ | ||
| ## Why yet another Google Maps integration for ReactJS? | ||
|
|
||
| ```sh | ||
| $ npm install react-gmaps --save | ||
| ``` | ||
| Why choose React GMaps when there's already [react-google-maps-api](https://github.com/JustFly1984/react-google-maps-api), [google-maps-react](https://github.com/fullstackreact/google-maps-react), [google-map-react](https://github.com/google-map-react/google-map-react), etc. ? | ||
| The current landscape doesn't really provide a smooth integration for GoogleMaps in a ReactJS application with hooks and modern patterns. | ||
| Existing implementations tends to be old/unmaintained, outdated, lacking features, and/or a bit wobbly. | ||
|
|
||
| Demo | ||
| ------------ | ||
|
|
||
| [http://react-gmaps.herokuapp.com/](http://react-gmaps.herokuapp.com/) | ||
|
|
||
| Usage | ||
| ----- | ||
|
|
||
| ```javascript | ||
| import React from 'react'; | ||
| import ReactDOM from 'react-dom'; | ||
| import {Gmaps, Marker, InfoWindow, Circle} from 'react-gmaps'; | ||
|
|
||
| const coords = { | ||
| lat: 51.5258541, | ||
| lng: -0.08040660000006028 | ||
| }; | ||
|
|
||
| const params = {v: '3.exp', key: 'YOUR_API_KEY'}; | ||
|
|
||
| class App extends React.Component { | ||
|
|
||
| onMapCreated(map) { | ||
| map.setOptions({ | ||
| disableDefaultUI: true | ||
| }); | ||
| } | ||
|
|
||
| onDragEnd(e) { | ||
| console.log('onDragEnd', e); | ||
| } | ||
|
|
||
| onCloseClick() { | ||
| console.log('onCloseClick'); | ||
| } | ||
|
|
||
| onClick(e) { | ||
| console.log('onClick', e); | ||
| } | ||
|
|
||
| render() { | ||
| return ( | ||
| <Gmaps | ||
| width={'800px'} | ||
| height={'600px'} | ||
| lat={coords.lat} | ||
| lng={coords.lng} | ||
| zoom={12} | ||
| loadingMessage={'Be happy'} | ||
| params={params} | ||
| onMapCreated={this.onMapCreated}> | ||
| <Marker | ||
| lat={coords.lat} | ||
| lng={coords.lng} | ||
| draggable={true} | ||
| onDragEnd={this.onDragEnd} /> | ||
| <InfoWindow | ||
| lat={coords.lat} | ||
| lng={coords.lng} | ||
| content={'Hello, React :)'} | ||
| onCloseClick={this.onCloseClick} /> | ||
| <Circle | ||
| lat={coords.lat} | ||
| lng={coords.lng} | ||
| radius={500} | ||
| onClick={this.onClick} /> | ||
| </Gmaps> | ||
| ); | ||
| } | ||
|
|
||
| }; | ||
|
|
||
| ReactDOM.render(<App />, document.getElementById('gmaps')); | ||
| ``` | ||
| React GMaps aims to be more flexible, extensible, and composable by exposing simple primitives that can be used in various ways. | ||
| It utilizes modern GoogleMaps features such as [AdvancedMarkers](https://developers.google.com/maps/documentation/javascript/reference/advanced-markers) to avoid wacky hacks and unstable integrations. | ||
| Plus its context base architecture, enables users to easly access GMaps functionalities programmaticaly and create GoogleMaps related libraries for others to use (similarly to the built-in [Animated components](/docs/components/gmaps-animated-marker.md)). | ||
|
|
||
| Test | ||
| ---- | ||
| ## TODOs | ||
|
|
||
| ```sh | ||
| $ npm test | ||
| ``` | ||
| Wanna help? See our [`contributing.md`](/CONTRIBUTING.md). | ||
|
|
||
| - [x] Marker component (displays ReactJS components) | ||
| - [ ] LegacyMarker component (displays images only) | ||
| - [x] Polyline component | ||
| - [x] Polygon component | ||
| - [ ] Circle component | ||
| - [ ] Rectangle component | ||
| - [ ] Overlays | ||
| - [ ] Hooks to access the `google` sdk and `google.maps.Map` instance using a `ref` to `<GMaps />` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.