Page.js 861 B

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