mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 02:56:41 +07:00
first map component
This commit is contained in:
parent
4a2a343e41
commit
a4eec9e2ed
6 changed files with 37 additions and 34 deletions
2
.babelrc
2
.babelrc
|
@ -1,8 +1,6 @@
|
||||||
{
|
{
|
||||||
"presets": ["env", "react","stage-2"],
|
"presets": ["env", "react","stage-2"],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"ramda",
|
|
||||||
"lodash",
|
|
||||||
"react-hot-loader/babel",
|
"react-hot-loader/babel",
|
||||||
["transform-runtime", {
|
["transform-runtime", {
|
||||||
"polyfill": false,
|
"polyfill": false,
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"react",
|
"react",
|
||||||
"jsx-a11y",
|
"jsx-a11y",
|
||||||
"import",
|
"import"
|
||||||
"jest"
|
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"quotes": 1,
|
"quotes": 1,
|
||||||
|
@ -43,9 +42,7 @@
|
||||||
"Element": true,
|
"Element": true,
|
||||||
"localStorage": true,
|
"localStorage": true,
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {},
|
||||||
"jest/globals": true
|
|
||||||
},
|
|
||||||
"settings": {
|
"settings": {
|
||||||
"import/resolver": {
|
"import/resolver": {
|
||||||
"webpack": {
|
"webpack": {
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
"description": "Beta Map",
|
"description": "Beta Map",
|
||||||
"main": "./src/js/index.js",
|
"main": "./src/js/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "NODE_ENV=development webpack-dev-server --mode development --hot --open --inline --progress"
|
"start": "NODE_ENV=development webpack-dev-server --mode development --hot --open --inline --progress",
|
||||||
|
"build": "NODE_ENV=production webpack --env production --config=webpack.config.js --progress"
|
||||||
},
|
},
|
||||||
"author": "Grigory Chervoplyas",
|
"author": "Grigory Chervoplyas",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Map } from "$containers/Map";
|
|
||||||
|
import { Map } from '../modules/map';
|
||||||
|
import { MapScreen } from "$styles/mapScreen";
|
||||||
|
|
||||||
export class App extends React.Component {
|
export class App extends React.Component {
|
||||||
|
componentDidMount() {
|
||||||
|
this.map = new Map('map');
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<MapScreen />
|
||||||
|
);
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
19
src/index.js
19
src/index.js
|
@ -2,28 +2,9 @@ import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
|
|
||||||
import { App } from '$containers/App';
|
import { App } from '$containers/App';
|
||||||
import { Provider } from 'react-redux';
|
|
||||||
|
|
||||||
import { ConnectedRouter } from 'react-router-redux';
|
|
||||||
import { PersistGate } from 'redux-persist/integration/react';
|
|
||||||
|
|
||||||
// import { configs } from '$constants/moment';
|
|
||||||
import configureStore, { history } from '$redux/store';
|
|
||||||
|
|
||||||
const { store, persistor } = configureStore();
|
|
||||||
|
|
||||||
// import './js/common';
|
|
||||||
// import './js/script';
|
|
||||||
import './css/style.css';
|
|
||||||
|
|
||||||
export const Index = () => (
|
export const Index = () => (
|
||||||
<Provider store={store}>
|
|
||||||
<PersistGate loading={null} persistor={persistor}>
|
|
||||||
<ConnectedRouter history={history}>
|
|
||||||
<App />
|
<App />
|
||||||
</ConnectedRouter>
|
|
||||||
</PersistGate>
|
|
||||||
</Provider>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
ReactDOM.render(<Index />, document.getElementById('index'));
|
ReactDOM.render(<Index />, document.getElementById('index'));
|
||||||
|
|
22
src/modules/map.js
Normal file
22
src/modules/map.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import L from "leaflet";
|
||||||
|
|
||||||
|
import { providers } from "$constants/providers";
|
||||||
|
|
||||||
|
import 'leaflet/dist/leaflet.css';
|
||||||
|
|
||||||
|
export class Map {
|
||||||
|
constructor(container) {
|
||||||
|
this.map = L.map(container, {
|
||||||
|
editable: true,
|
||||||
|
layers: [
|
||||||
|
|
||||||
|
]
|
||||||
|
}).setView([55.0153275, 82.9071235], 13);
|
||||||
|
|
||||||
|
this.tileLayer = L.tileLayer(providers.default, {
|
||||||
|
attribution: 'Независимое Велосообщество',
|
||||||
|
maxNativeZoom: 18,
|
||||||
|
maxZoom: 18,
|
||||||
|
}).addTo(this.map);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue