import React from 'react'; import PropTypes from 'prop-types'; import { templateChecker, pagePathUtils } from '@growi/core'; const { isTopPage } = pagePathUtils; const { checkTemplatePath } = templateChecker; export class PageListMeta extends React.Component { render() { const { page } = this.props; // top check let topLabel; if (isTopPage(page.path)) { topLabel = TOP; } // template check let templateLabel; if (checkTemplatePath(page.path)) { templateLabel = TMPL; } let commentCount; if (page.commentCount != null && page.commentCount > 0) { commentCount = {page.commentCount}; } let likerCount; if (page.liker != null && page.liker.length > 0) { likerCount = {page.liker.length}; } let locked; if (page.grant !== 1) { locked = ; } let bookmarkCount; if (this.props.bookmarkCount > 0) { bookmarkCount = {this.props.bookmarkCount}; } return ( {topLabel} {templateLabel} {commentCount} {likerCount} {locked} {bookmarkCount} ); } } PageListMeta.propTypes = { page: PropTypes.object.isRequired, bookmarkCount: PropTypes.number, }; PageListMeta.defaultProps = { };