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
Tom Moor 18b0338736 Pinned documents (#608)
* Migrations and API for pinned documents

* Documentation

* Add pin icon

* Fin.

* v0.2.0

* Remove pin from DocumentPreview, add general menu
Add Pinned documents header

* Tidy

* Fixed: Drafts appearing on collection home
2018-02-28 23:28:36 -08:00

38 lines
904 B
JavaScript

// @flow
import React from 'react';
import Document from 'models/Document';
import DocumentPreview from 'components/DocumentPreview';
import ArrowKeyNavigation from 'boundless-arrow-key-navigation';
class DocumentList extends React.Component {
props: {
documents: Document[],
showCollection?: boolean,
limit?: number,
};
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;