Files
outline/app/components/PaginatedDocumentList.tsx
2021-12-30 16:54:02 -08:00

47 lines
1.0 KiB
TypeScript

import * as React from "react";
import Document from "~/models/Document";
import DocumentListItem from "~/components/DocumentListItem";
import PaginatedList from "~/components/PaginatedList";
type Props = {
documents: Document[];
fetch: (options: any) => Promise<void>;
options?: Record<string, any>;
heading?: React.ReactNode;
empty?: React.ReactNode;
showParentDocuments?: boolean;
showCollection?: boolean;
showPublished?: boolean;
showDraft?: boolean;
showTemplate?: boolean;
};
const PaginatedDocumentList = React.memo<Props>(function PaginatedDocumentList({
empty,
heading,
documents,
fetch,
options,
...rest
}: Props) {
return (
<PaginatedList
items={documents}
empty={empty}
heading={heading}
fetch={fetch}
options={options}
renderItem={(item) => (
<DocumentListItem
key={item.id}
document={item}
showPin={!!options?.collectionId}
{...rest}
/>
)}
/>
);
});
export default PaginatedDocumentList;