Created
July 28, 2016 15:56
-
-
Save petyappetrov/cbb7398bfa7dd689be9cb37e45f4107f to your computer and use it in GitHub Desktop.
Юре
This file contains 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
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
// | |
// Copyright (C) 2008-2016 Quantron Systems LLC. | |
// All Rights Reserved. | |
// | |
// This file is part of the Pakmil project. | |
// For conditions of distribution and use, | |
// please contact sales@quantron-systems.com | |
// | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
import React from 'react'; | |
import styles from './styles.css'; | |
import CSSModules from 'react-css-modules'; | |
/* global ymaps */ | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
const Yandexmap = React.createClass({ | |
propTypes(){ | |
return { | |
lat: React.PropTypes.number, | |
lng: React.PropTypes.number, | |
id: React.PropTypes.string, | |
mark: React.PropTypes.string | |
}; | |
}, | |
getDefaultProps(){ | |
return { | |
lat: null, | |
lng: null, | |
id: null, | |
mark: null | |
}; | |
}, | |
getInitialState(){ | |
return { | |
mapRendered: false | |
}; | |
}, | |
componentDidMount(){ | |
const {lat, lng, id, mark} = this.props; | |
const init = () => { | |
const yandexMap = new ymaps.Map(id, { | |
center: [lat, lng], | |
zoom: 12, | |
controls: ['largeMapDefaultSet'] | |
}); | |
yandexMap.geoObjects.add(new ymaps.Placemark([lat, lng], { | |
iconCaption: mark | |
}, { | |
preset: 'islands#redDotIconWithCaption' | |
})); | |
}; | |
ymaps.ready(init); | |
}, | |
render(){ | |
return ( | |
<div styleName='map' id={this.props.id}/> | |
); | |
} | |
}); | |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
export default CSSModules(Yandexmap, styles); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment