SearchResultContent.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React, { FC } from 'react';
  2. import RevisionLoader from '../Page/RevisionLoader';
  3. import AppContainer from '../../client/services/AppContainer';
  4. import SearchResultContentSubNavigation from './SearchResultContentSubNavigation';
  5. // TODO : set focusedPage type to ?IPageSearchResultData once #80214 is merged
  6. // PR: https://github.com/weseek/growi/pull/4649
  7. type Props ={
  8. appContainer: AppContainer,
  9. searchingKeyword:string,
  10. focusedPage: null | any,
  11. }
  12. const SearchResultContent: FC<Props> = (props: Props) => {
  13. const page = props.focusedPage;
  14. if (page == null) return null;
  15. const growiRenderer = props.appContainer.getRenderer('searchresult');
  16. let showTags = false;
  17. if (page.tags != null && page.tags.length > 0) { showTags = true }
  18. return (
  19. <div key={page._id} className="search-result-page mb-5">
  20. <SearchResultContentSubNavigation pageId={page._id} path={page.path}></SearchResultContentSubNavigation>
  21. <RevisionLoader
  22. growiRenderer={growiRenderer}
  23. pageId={page._id}
  24. pagePath={page.path}
  25. revisionId={page.revision}
  26. highlightKeywords={props.searchingKeyword}
  27. />
  28. </div>
  29. );
  30. };
  31. export default SearchResultContent;