mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-27 08:54:32 +00:00
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { Card, Pagination } from 'antd';
|
|
import * as React from 'react';
|
|
|
|
interface Props {
|
|
typeName: string;
|
|
pageStart: number;
|
|
pageSize: number;
|
|
totalResults: number;
|
|
results: React.ReactNode;
|
|
onChangePage: (page: number) => void;
|
|
}
|
|
|
|
export const SearchResults = ({ typeName, pageStart, pageSize, totalResults, results, onChangePage }: Props) => {
|
|
return (
|
|
<Card
|
|
title={<h1 style={{ marginBottom: '0px' }}>{typeName}</h1>}
|
|
extra={
|
|
<div style={{ color: 'grey' }}>
|
|
Showing {pageStart * pageSize} - {pageStart * pageSize + pageSize} of {totalResults} results
|
|
</div>
|
|
}
|
|
>
|
|
{results}
|
|
<Pagination
|
|
style={{ width: '100%', display: 'flex', justifyContent: 'center' }}
|
|
current={pageStart}
|
|
pageSize={pageSize}
|
|
total={totalResults / pageSize}
|
|
showLessItems
|
|
onChange={onChangePage}
|
|
showSizeChanger={false}
|
|
/>
|
|
</Card>
|
|
);
|
|
};
|