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
{this.props.brew.description || 'No description.'}
{this.getAuthors()}
{this.getTags()}
{this.getSystems()}
{Moment(this.props.brew.updatedAt).fromNow()}