| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import React, { FC } from 'react';
- import SearchResultListItem from './SearchResultListItem';
- import { IPageHasId } from '../../interfaces/page';
- import PaginationWrapper from '../PaginationWrapper';
- // TOOD: retrieve bookmark count and add it to the following type
- export type ISearchedPage = IPageHasId & {
- snippet: string,
- elasticSearchResult: {
- snippet: string,
- matchedPath: string,
- },
- };
- type Props = {
- pages: ISearchedPage[],
- selectedPages: ISearchedPage[],
- onClickInvoked?: (pageId: string) => void,
- searchResultCount?: number,
- activePage?: number,
- pagingLimit?: number,
- onPagingNumberChanged?: (activePage: number) => void,
- }
- const SearchResultList: FC<Props> = (props:Props) => {
- return (
- <>
- {props.pages.map((page) => {
- return (
- <SearchResultListItem
- page={page}
- onClickInvoked={props.onClickInvoked}
- />
- );
- })}
- {props.searchResultCount != null && props.searchResultCount > 0 && (
- <div className="my-4 mx-auto">
- <PaginationWrapper
- activePage={props.activePage || 1}
- changePage={props.onPagingNumberChanged}
- totalItemsCount={props.searchResultCount || 0}
- pagingLimit={props.pagingLimit}
- />
- </div>
- )}
- </>
- );
- };
- export default SearchResultList;
|