| 
									
										
										
										
											2017-12-15 13:53:32 -08:00
										 |  |  | import React, { PureComponent } from 'react'; | 
					
						
							| 
									
										
										
										
											2017-11-09 17:10:30 -08:00
										 |  |  | import PropTypes from 'prop-types'; | 
					
						
							| 
									
										
										
										
											2017-07-31 20:04:01 -07:00
										 |  |  | import { connect } from 'react-redux'; | 
					
						
							|  |  |  | import { Col, Row } from 'react-bootstrap'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ns from './ns.json'; | 
					
						
							|  |  |  | import SuperBlock from './Super-Block.jsx'; | 
					
						
							|  |  |  | import { superBlocksSelector } from '../redux'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const mapStateToProps = state => ({ | 
					
						
							|  |  |  |   superBlocks: superBlocksSelector(state) | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const mapDispatchToProps = {}; | 
					
						
							|  |  |  | const propTypes = { | 
					
						
							|  |  |  |   params: PropTypes.object, | 
					
						
							|  |  |  |   superBlocks: PropTypes.array | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export class ShowMap extends PureComponent { | 
					
						
							|  |  |  |   renderSuperBlocks(superBlocks) { | 
					
						
							|  |  |  |     if (!Array.isArray(superBlocks) || !superBlocks.length) { | 
					
						
							|  |  |  |       return <div>No Super Blocks</div>; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return superBlocks.map(dashedName => ( | 
					
						
							|  |  |  |       <SuperBlock | 
					
						
							|  |  |  |         dashedName={ dashedName } | 
					
						
							|  |  |  |         key={ dashedName } | 
					
						
							|  |  |  |       /> | 
					
						
							|  |  |  |     )); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   render() { | 
					
						
							|  |  |  |     const { superBlocks } = this.props; | 
					
						
							|  |  |  |     return ( | 
					
						
							|  |  |  |       <Row> | 
					
						
							|  |  |  |         <Col xs={ 12 }> | 
					
						
							|  |  |  |           <div className={ `${ns}-accordion center-block` }> | 
					
						
							|  |  |  |             { this.renderSuperBlocks(superBlocks) } | 
					
						
							|  |  |  |             <div className='spacer' /> | 
					
						
							|  |  |  |           </div> | 
					
						
							|  |  |  |         </Col> | 
					
						
							|  |  |  |       </Row> | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ShowMap.displayName = 'Map'; | 
					
						
							|  |  |  | ShowMap.propTypes = propTypes; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default connect( | 
					
						
							|  |  |  |   mapStateToProps, | 
					
						
							|  |  |  |   mapDispatchToProps | 
					
						
							|  |  |  | )(ShowMap); |