var React = require('react'), // ## components { Well, Row, Col, Button, } = require('react-bootstrap'); var SidePanel = React.createClass({ propTypes: { name: React.PropTypes.string, brief: React.PropTypes.string, description: React.PropTypes.array, difficulty: React.PropTypes.number, onTestBonfire: React.PropTypes.func }, getDefaultProps: function() { return { name: 'Welcome to Bonfires!', difficulty: 5, brief: 'This is a brief description' }; }, getInitialState: function() { return { isMoreInfoOpen: false }; }, _toggleMoreInfo: function() { this.setState({ isMoreInfoOpen: !this.state.isMoreInfoOpen }); }, _renderFlames: function() { var difficulty = this.props.difficulty; return [1, 2, 3, 4, 5].map(num => { var className = 'ion-ios-flame'; if (num > difficulty) { className += '-outline'; } return ( ); }); }, _renderMoreInfo: function(isDescription) { var description = this.props.description.map((sentance, index) => { return

{ sentance }

; }); if (isDescription && this.state.isMoreInfoOpen) { return ( { description } ); } return null; }, _renderMoreInfoButton: function(isDescription) { if (isDescription) { return ( ); } return null; }, render: function() { var isDescription = this.props.description && this.props.description.length > 1; return (

{ this.props.name }

Difficulty:  { this._renderFlames() }

{ this.props.brief }

{ this._renderMoreInfo(isDescription) } { this._renderMoreInfoButton(isDescription) }

); } }); module.exports = SidePanel;