import React from 'react'; import PropTypes from 'prop-types'; import templateChecker from '@commons/util/template-checker'; import { isTopPage } from '@commons/util/path-utils'; export default class PageListMeta extends React.Component { render() { const { page } = this.props; // portal check let portalLabel; if (isTopPage(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}; } let locked; if (page.grant !== 1) { locked = ; } return ( {portalLabel} {templateLabel} {commentCount} {likerCount} {locked} ); } } PageListMeta.propTypes = { page: PropTypes.object.isRequired, }; PageListMeta.defaultProps = { };