SearchResultContent.tsx 1.3 KB

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