SearchResultList.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import Page from '../Page.js';
  4. export default class SearchResultList extends React.Component {
  5. constructor(props) {
  6. super(props);
  7. }
  8. render() {
  9. var isEnabledLineBreaks = $('#content-main').data('linebreaks-enabled');
  10. const resultList = this.props.pages.map((page) => {
  11. const pageBody = page.revision.body;
  12. return (
  13. <div id={page._id} key={page._id} className="search-result-page">
  14. <h2><a href={page.path}>{page.path}</a></h2>
  15. <div className="wiki">
  16. <Page
  17. crowi={this.props.crowi}
  18. crowiRenderer={this.props.crowiRenderer}
  19. markdown={pageBody}
  20. pagePath={page.path}
  21. // highlightKeywords={this.props.searchingKeyword}
  22. />
  23. </div>
  24. </div>
  25. );
  26. });
  27. return (
  28. <div>
  29. {resultList}
  30. </div>
  31. );
  32. }
  33. }
  34. SearchResultList.propTypes = {
  35. crowi: PropTypes.object.isRequired,
  36. crowiRenderer: PropTypes.object.isRequired,
  37. pages: PropTypes.array.isRequired,
  38. searchingKeyword: PropTypes.string.isRequired,
  39. };
  40. SearchResultList.defaultProps = {
  41. pages: [],
  42. searchingKeyword: '',
  43. };