This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
2018-08-11 06:03:47 +00:00
|
|
|
// @flow
|
2020-06-20 20:59:15 +00:00
|
|
|
import * as React from "react";
|
|
|
|
import Document from "models/Document";
|
|
|
|
import DocumentPreview from "components/DocumentPreview";
|
|
|
|
import ArrowKeyNavigation from "boundless-arrow-key-navigation";
|
2018-08-11 06:03:47 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
documents: Document[],
|
|
|
|
limit?: number,
|
|
|
|
};
|
|
|
|
|
2019-04-06 23:20:27 +00:00
|
|
|
export default function DocumentList({ limit, documents, ...rest }: Props) {
|
2018-08-11 06:03:47 +00:00
|
|
|
const items = limit ? documents.splice(0, limit) : documents;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ArrowKeyNavigation
|
|
|
|
mode={ArrowKeyNavigation.mode.VERTICAL}
|
|
|
|
defaultActiveChildIndex={0}
|
|
|
|
>
|
|
|
|
{items.map(document => (
|
2019-04-06 23:20:27 +00:00
|
|
|
<DocumentPreview key={document.id} document={document} {...rest} />
|
2018-08-11 06:03:47 +00:00
|
|
|
))}
|
|
|
|
</ArrowKeyNavigation>
|
|
|
|
);
|
|
|
|
}
|