Blame view

imports/ui/components/DocumentsList.js 653 Bytes
d1f05315d   tmcdeveloper   wip adding API an...
1
  import React from 'react';
a5b247a92   Paul Savignano   Refactor hrefs to...
2
  import { browserHistory } from 'react-router';
c42d4eeac   themeteorchef   handful of changes
3
  import { ListGroup, ListGroupItem, Alert } from 'react-bootstrap';
d1f05315d   tmcdeveloper   wip adding API an...
4

a5b247a92   Paul Savignano   Refactor hrefs to...
5
6
7
  const handleNav = (_id) => {
    browserHistory.push(`/documents/${_id}`);
  }
3540345c5   themeteorchef   handful of fixes
8
  const DocumentsList = ({ documents }) => (
c42d4eeac   themeteorchef   handful of changes
9
10
    documents.length > 0 ? <ListGroup className="DocumentsList">
      {documents.map(({ _id, title }) => (
a5b247a92   Paul Savignano   Refactor hrefs to...
11
12
13
        <ListGroupItem key={ _id } onClick={ () => handleNav(_id) }>
          { title }
        </ListGroupItem>
f0c912bf1   tmcdeveloper   add method tests ...
14
15
16
17
      ))}
    </ListGroup> :
    <Alert bsStyle="warning">No documents yet.</Alert>
  );
76dd62c7b   tmcdeveloper   fix eslint error ...
18
19
20
21
  
  DocumentsList.propTypes = {
    documents: React.PropTypes.array,
  };
3540345c5   themeteorchef   handful of fixes
22
23
  
  export default DocumentsList;