import React, { Component, PropTypes } from 'react' class MapCard extends Component { render = () => { const { map, currentUser } = this.props function capitalize (string) { return string.charAt(0).toUpperCase() + string.slice(1) } const n = map.get('name') const d = map.get('desc') const maxNameLength = 32 const maxDescLength = 118 const truncatedName = n ? (n.length > maxNameLength ? n.substring(0, maxNameLength) + '...' : n) : '' const truncatedDesc = d ? (d.length > maxDescLength ? d.substring(0, maxDescLength) + '...' : d) : '' const editPermission = map.authorizeToEdit(currentUser) ? 'canEdit' : 'cannotEdit' return (
) } } MapCard.propTypes = { map: PropTypes.object.isRequired, currentUser: PropTypes.object } export default MapCard