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.
Files
outline/app/components/DocumentList/DocumentList.js
2018-05-05 16:16:08 -07:00

38 lines
912 B
JavaScript

// @flow
import * as React from 'react';
import Document from 'models/Document';
import DocumentPreview from 'components/DocumentPreview';
import ArrowKeyNavigation from 'boundless-arrow-key-navigation';
type Props = {
documents: Document[],
showCollection?: boolean,
limit?: number,
};
class DocumentList extends React.Component<Props> {
render() {
const { limit, showCollection } = this.props;
const documents = limit
? this.props.documents.splice(0, limit)
: this.props.documents;
return (
<ArrowKeyNavigation
mode={ArrowKeyNavigation.mode.VERTICAL}
defaultActiveChildIndex={0}
>
{documents.map(document => (
<DocumentPreview
key={document.id}
document={document}
showCollection={showCollection}
/>
))}
</ArrowKeyNavigation>
);
}
}
export default DocumentList;