import React from 'react'; import PropTypes from 'prop-types'; import RevisionLoader from '../Page/RevisionLoader'; import AppContainer from '../../services/AppContainer'; import { createSubscribedElement } from '../UnstatedUtils'; class SearchResultList extends React.Component { constructor(props) { super(props); this.growiRenderer = this.props.appContainer.getRenderer('searchresult'); } render() { const resultList = this.props.pages.map((page) => { const showTags = (page.tags != null) && (page.tags.length > 0); return ( // Add prefix 'id_' in id attr, because scrollspy of bootstrap doesn't work when the first letter of id of target component is numeral.

{page.path} { showTags && (
{page.tags.join(', ')}
)}

); }); return (
{resultList}
); } } /** * Wrapper component for using unstated */ const SearchResultListWrapper = (props) => { return createSubscribedElement(SearchResultList, props, [AppContainer]); }; SearchResultList.propTypes = { appContainer: PropTypes.instanceOf(AppContainer).isRequired, pages: PropTypes.array.isRequired, searchingKeyword: PropTypes.string.isRequired, }; SearchResultList.defaultProps = { }; export default SearchResultListWrapper;