2021-02-03 11:49:51 -08:00
|
|
|
import { Card, Pagination } from 'antd';
|
2021-01-17 12:54:49 -08:00
|
|
|
import * as React from 'react';
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
typeName: string;
|
|
|
|
|
pageStart: number;
|
|
|
|
|
pageSize: number;
|
|
|
|
|
totalResults: number;
|
2021-02-10 14:19:27 -08:00
|
|
|
results: React.ReactNode;
|
2021-01-17 12:54:49 -08:00
|
|
|
onChangePage: (page: number) => void;
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-03 11:49:51 -08:00
|
|
|
export const SearchResults = ({ typeName, pageStart, pageSize, totalResults, results, onChangePage }: Props) => {
|
2021-01-17 12:54:49 -08:00
|
|
|
return (
|
|
|
|
|
<Card
|
2021-02-03 11:49:51 -08:00
|
|
|
title={<h1 style={{ marginBottom: '0px' }}>{typeName}</h1>}
|
2021-01-17 12:54:49 -08:00
|
|
|
extra={
|
|
|
|
|
<div style={{ color: 'grey' }}>
|
2021-02-03 11:49:51 -08:00
|
|
|
Showing {pageStart * pageSize} - {pageStart * pageSize + pageSize} of {totalResults} results
|
2021-01-17 12:54:49 -08:00
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
>
|
2021-02-03 11:49:51 -08:00
|
|
|
{results}
|
2021-01-17 12:54:49 -08:00
|
|
|
<Pagination
|
|
|
|
|
style={{ width: '100%', display: 'flex', justifyContent: 'center' }}
|
2021-02-03 11:49:51 -08:00
|
|
|
current={pageStart}
|
|
|
|
|
pageSize={pageSize}
|
|
|
|
|
total={totalResults / pageSize}
|
2021-01-17 12:54:49 -08:00
|
|
|
showLessItems
|
2021-02-03 11:49:51 -08:00
|
|
|
onChange={onChangePage}
|
2021-04-27 16:12:03 -07:00
|
|
|
showSizeChanger={false}
|
2021-01-17 12:54:49 -08:00
|
|
|
/>
|
|
|
|
|
</Card>
|
|
|
|
|
);
|
|
|
|
|
};
|