Page.js 885 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import UserPicture from '../User/UserPicture';
  4. import PageListMeta from './PageListMeta';
  5. import PagePath from './PagePath';
  6. export default class Page extends React.Component {
  7. render() {
  8. const page = this.props.page;
  9. let link = this.props.linkTo;
  10. if (link === '') {
  11. link = page.path;
  12. }
  13. return (
  14. <li className="page-list-li">
  15. {this.props.children}
  16. <UserPicture user={page.revision.author} />
  17. <a className="page-list-link" href={link}>
  18. <PagePath page={page} excludePathString={this.props.excludePathString} />
  19. </a>
  20. <PageListMeta page={page} />
  21. </li>
  22. );
  23. }
  24. }
  25. Page.propTypes = {
  26. page: PropTypes.object.isRequired,
  27. linkTo: PropTypes.string,
  28. };
  29. Page.defaultProps = {
  30. page: {},
  31. linkTo: '',
  32. excludePathString: '',
  33. };