metamaps--metamaps/frontend/src/components/MapView/MapInfoBox.js

24 lines
729 B
JavaScript
Raw Normal View History

2017-03-11 01:49:27 -05:00
import React, { Component, PropTypes } from 'react'
class MapInfoBox extends Component {
static propTypes = {
2017-03-11 09:56:09 -05:00
currentUser: PropTypes.object,
2017-03-11 21:13:58 -05:00
map: PropTypes.object,
infoBoxHtml: PropTypes.string
2017-03-11 01:49:27 -05:00
}
render () {
2017-03-11 21:13:58 -05:00
const { currentUser, map, infoBoxHtml } = this.props
2017-03-11 09:56:09 -05:00
if (!map) return null
2017-03-11 21:13:58 -05:00
const html = {__html: infoBoxHtml}
const isCreator = map.authorizePermissionChange(currentUser)
const canEdit = map.authorizeToEdit(currentUser)
let classes = 'mapInfoBox mapElement mapElementHidden permission '
classes += isCreator ? 'yourMap' : ''
classes += canEdit ? ' canEdit' : ''
return <div className={classes} dangerouslySetInnerHTML={html}></div>
2017-03-11 01:49:27 -05:00
}
}
export default MapInfoBox