const React = require('react'); const createClass = require('create-react-class'); const _ = require('lodash'); const Moment = require('moment'); const Nav = require('naturalcrit/nav/nav.jsx'); const MetadataNav = createClass({ DisplayName : 'MetadataNav', getDefaultProps : function() { return { }; }, getInitialState : function() { return { showMetaWindow : false }; }, componentDidMount : function() { }, toggleMetaWindow : function(){ this.setState((prevProps)=>({ showMetaWindow : !prevProps.showMetaWindow })); }, getAuthors : function(){ if(!this.props.brew.authors) return 'No authors'; return this.props.brew.authors.join(', '); }, getTags : function(){ if(!this.props.brew.tags) return 'No tags'; return this.props.brew.tags.join(', '); }, getSystems : function(){ if(!this.props.brew.systems) return 'No systems'; return this.props.brew.systems.join(', '); }, renderMetaWindow : function(){ if(!this.state.showMetaWindow) return null; return

Description

{this.props.brew.description || 'No description.'}

Authors

{this.getAuthors()}

Tags

{this.getTags()}

Systems

{this.getSystems()}

Last Updated

{Moment(this.props.brew.updatedAt).fromNow()}

; }, render : function(){ return this.toggleMetaWindow()}> {this.props.children} {this.renderMetaWindow()} ; } }); module.exports = MetadataNav;