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 { pageData, pageMeta } = this.props; // top check let topLabel; if (isTopPage(pageData.path)) { topLabel = TOP; } // template check let templateLabel; if (checkTemplatePath(pageData.path)) { templateLabel = TMPL; } let commentCount; if (pageData.commentCount > 0) { commentCount = {pageData.commentCount}; } let likerCount; if (pageData.liker.length > 0) { likerCount = {pageData.liker.length}; } let locked; if (pageData.grant !== 1) { locked = ; } let bookmarkCount; if (pageMeta.bookmarkCount > 0) { bookmarkCount = {pageMeta.bookmarkCount}; } return ( {topLabel} {templateLabel} {commentCount} {likerCount} {locked} {bookmarkCount} ); } } PageListMeta.propTypes = { pageData: PropTypes.object.isRequired, pageMeta: PropTypes.object.isRequired, }; PageListMeta.defaultProps = { };