import React from 'react'; import PropTypes from 'prop-types'; export default class PageListMeta extends React.Component { isPortalPath(path) { if (path.match(/.*\/$/)) { return true; } return false; } render() { // TODO isPortal() const page = this.props.page; const templateChecker = require('../../../../lib/util/templateChecker'); // portal check let PortalLabel; if (this.isPortalPath(page.path)) { PortalLabel = PORTAL; } // template check let TemplateLabel; if (templateChecker(page.path)) { TemplateLabel = TMPL; } let CommentCount; if (page.commentCount > 0) { CommentCount = {page.commentCount}; } let LikerCount; if (page.liker.length > 0) { LikerCount = {page.liker.length}; } return ( {PortalLabel} {TemplateLabel} {CommentCount} {LikerCount} ); } } PageListMeta.propTypes = { page: PropTypes.object.isRequired, }; PageListMeta.defaultProps = { page: {}, };