SearchResultList.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. <Page
  16. crowi={this.props.crowi}
  17. crowiRenderer={this.props.crowiRenderer}
  18. markdown={pageBody}
  19. pagePath={page.path}
  20. // highlightKeywords={this.props.searchingKeyword}
  21. />
  22. </div>
  23. );
  24. });
  25. return (
  26. <div>
  27. {resultList}
  28. </div>
  29. );
  30. }
  31. }
  32. SearchResultList.propTypes = {
  33. crowi: PropTypes.object.isRequired,
  34. crowiRenderer: PropTypes.object.isRequired,
  35. pages: PropTypes.array.isRequired,
  36. searchingKeyword: PropTypes.string.isRequired,
  37. };
  38. SearchResultList.defaultProps = {
  39. pages: [],
  40. searchingKeyword: '',
  41. };