Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 65ab792

Browse files
committed
initial commit
1 parent 38854c6 commit 65ab792

File tree

11 files changed

+1162
-0
lines changed

11 files changed

+1162
-0
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# dependencies
4+
node_modules
5+
6+
# testing
7+
coverage
8+
9+
# production
10+
build
11+
12+
# misc
13+
.DS_Store
14+
.env
15+
npm-debug.log

README.md

+983
Large diffs are not rendered by default.

package.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "create-react-app-esri-loader",
3+
"version": "0.1.0",
4+
"private": true,
5+
"devDependencies": {
6+
"react-scripts": "0.7.0"
7+
},
8+
"dependencies": {
9+
"esri-loader": "^0.1.2",
10+
"react": "^15.4.1",
11+
"react-dom": "^15.4.1"
12+
},
13+
"scripts": {
14+
"start": "react-scripts start",
15+
"build": "react-scripts build",
16+
"test": "react-scripts test --env=jsdom",
17+
"eject": "react-scripts eject"
18+
}
19+
}

public/favicon.ico

24.3 KB
Binary file not shown.

public/index.html

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
7+
<!--
8+
Notice the use of %PUBLIC_URL% in the tag above.
9+
It will be replaced with the URL of the `public` folder during the build.
10+
Only files inside the `public` folder can be referenced from the HTML.
11+
12+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
13+
work correctly both with client-side routing and a non-root public URL.
14+
Learn how to configure a non-root public URL by running `npm run build`.
15+
-->
16+
<title>React App</title>
17+
<link href="https://js.arcgis.com/4.1/esri/css/main.css" rel="stylesheet">
18+
</head>
19+
<body>
20+
<div id="root"></div>
21+
<!--
22+
This HTML file is a template.
23+
If you open it directly in the browser, you will see an empty page.
24+
25+
You can add webfonts, meta tags, or analytics to this file.
26+
The build step will place the bundled scripts into the <body> tag.
27+
28+
To begin the development, run `npm start`.
29+
To create a production bundle, use `npm run build`.
30+
-->
31+
</body>
32+
</html>

src/App.css

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.App {
2+
text-align: center;
3+
}
4+
5+
.App-logo {
6+
animation: App-logo-spin infinite 20s linear;
7+
height: 80px;
8+
}
9+
10+
.App-header {
11+
background-color: #222;
12+
height: 150px;
13+
padding: 20px;
14+
color: white;
15+
}
16+
17+
.App-intro {
18+
font-size: large;
19+
}
20+
21+
@keyframes App-logo-spin {
22+
from { transform: rotate(0deg); }
23+
to { transform: rotate(360deg); }
24+
}
25+
26+
.map-view {
27+
width: 80%;
28+
height: 400px;
29+
border: solid 1px red;
30+
margin: 0 auto;
31+
}

src/App.js

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import React, { Component } from 'react';
2+
import logo from './logo.svg';
3+
import './App.css';
4+
import { isLoaded, bootstrap, dojoRequire } from 'esri-loader';
5+
6+
class App extends Component {
7+
8+
createMap() {
9+
10+
dojoRequire(['esri/Map', 'esri/views/MapView'], (Map, MapView) => {
11+
new MapView({
12+
container: this.refs.mapView,
13+
map: new Map({basemap: 'topo'})
14+
})
15+
});
16+
}
17+
18+
componentWillMount() {
19+
20+
if (!isLoaded()) {
21+
bootstrap((err) => {
22+
if (err) {
23+
console.error(err);
24+
}
25+
26+
this.createMap();
27+
}, {
28+
url: 'https://js.arcgis.com/4.1/'
29+
});
30+
} else {
31+
32+
this.createMap();
33+
}
34+
}
35+
36+
render() {
37+
38+
return (
39+
<div className="App">
40+
<div className="App-header">
41+
<img src={logo} className="App-logo" alt="logo" />
42+
<h2>Welcome to React</h2>
43+
</div>
44+
<p className="App-intro">
45+
To get started, edit <code>src/App.js</code> and save to reload.
46+
</p>
47+
<div ref='mapView' className='map-view'></div>
48+
</div>
49+
);
50+
}
51+
}
52+
53+
export default App;

src/App.test.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import App from './App';
4+
5+
it('renders without crashing', () => {
6+
const div = document.createElement('div');
7+
ReactDOM.render(<App />, div);
8+
});

src/index.css

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
font-family: sans-serif;
5+
}

src/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import App from './App';
4+
import './index.css';
5+
6+
ReactDOM.render(
7+
<App />,
8+
document.getElementById('root')
9+
);

src/logo.svg

+7
Loading

0 commit comments

Comments
 (0)