Refactored collections store and layout components

This commit is contained in:
Jori Lallo
2017-05-26 12:56:10 -07:00
parent 1247fd1cd2
commit 201f90030c
29 changed files with 382 additions and 348 deletions

View File

@ -2,12 +2,9 @@
import React from 'react';
import { observer } from 'mobx-react';
import { Link } from 'react-router-dom';
import DocumentLink from './components/DocumentLink';
import moment from 'moment';
import styles from './Collection.scss';
// import classNames from 'classnames/bind';
// const cx = classNames.bind(styles);
@observer class Collection extends React.Component {
static propTypes = {
@ -24,7 +21,18 @@ import styles from './Collection.scss';
</h2>
{data.recentDocuments.length > 0
? data.recentDocuments.map(document => {
return <DocumentLink document={document} key={document.id} />;
return (
<Link
key={document.id}
to={document.url}
className={styles.link}
>
<h3 className={styles.title}>{document.title}</h3>
<span className={styles.timestamp}>
{moment(document.updatedAt).fromNow()}
</span>
</Link>
);
})
: <div className={styles.description}>
No documents. Why not