Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions basic/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Basic example
---
## Basic example

Initialize a map with coordinates set by React, update the state of coordinates on map movement, and display that data in an element provided by the render function.

Expand All @@ -15,4 +14,10 @@ Initialize a map with coordinates set by React, update the state of coordinates

open http://localhost:3000/

### Access token

mapboxgl.accessToken = // YOUR_API_KEY_HERE

Replace the [API key](https://docs.mapbox.com/help/getting-started/access-tokens/) in `src/Map.js`.

Runs the app from http://localhost:3000
26,555 changes: 15,005 additions & 11,550 deletions basic/package-lock.json

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@
"name": "basic",
"version": "0.1.0",
"dependencies": {
"mapbox-gl": "^1.11.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "^3.4.3"
"mapbox-gl": "^2.15.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
Expand Down
16 changes: 13 additions & 3 deletions basic/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link href='https://api.mapbox.com/mapbox-assembly/mbx/v0.18.0/assembly.min.css' rel='stylesheet'>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.11.1/mapbox-gl.css' rel='stylesheet' />
<link
href="https://api.mapbox.com/mapbox-assembly/v1.5.1/assembly.min.css"
rel="stylesheet"
/>
<link
href="https://api.tiles.mapbox.com/mapbox-gl-js/v1.11.1/mapbox-gl.css"
rel="stylesheet"
/>
<script
async
defer
src="https://api.mapbox.com/mapbox-assembly/v1.5.1/assembly.js"
></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Basic</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src='https://api.mapbox.com/mapbox-assembly/mbx/v0.18.0/assembly.js'></script>
</body>
</html>
8 changes: 4 additions & 4 deletions basic/src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import ReactDOM from 'react-dom';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';

ReactDOM.render(
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
</React.StrictMode>
);
9 changes: 7 additions & 2 deletions data-overlay/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Data overlay example
---
## Data overlay example

Add a data overlay to a map via React and use controls to visualize it differently.

Expand All @@ -15,6 +14,12 @@ Add a data overlay to a map via React and use controls to visualize it different

open http://localhost:3000/

### Access token

mapboxgl.accessToken = // YOUR_API_KEY_HERE

Replace the [API key](https://docs.mapbox.com/help/getting-started/access-tokens/) in `src/Map.js`.

Runs the app from http://localhost:3000

Data provided by [Natural Earth](http://www.naturalearthdata.com/).
Loading