2017-05-12 00:23:56 +00:00
|
|
|
// @flow
|
2016-05-20 16:02:39 +00:00
|
|
|
import React from 'react';
|
2016-08-15 19:41:41 +00:00
|
|
|
import { toJS } from 'mobx';
|
2017-05-17 07:11:13 +00:00
|
|
|
import { Link } from 'react-router-dom';
|
2017-05-25 07:07:41 +00:00
|
|
|
import type { Document } from 'types';
|
|
|
|
import styled from 'styled-components';
|
2017-05-10 07:02:11 +00:00
|
|
|
import PublishingInfo from 'components/PublishingInfo';
|
2017-05-25 07:07:41 +00:00
|
|
|
import Markdown from 'components/Markdown';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
document: Document,
|
|
|
|
};
|
|
|
|
|
|
|
|
const Container = styled.div`
|
|
|
|
width: 100%;
|
|
|
|
padding: 20px 0;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const DocumentPreview = ({ document }: Props) => {
|
|
|
|
return (
|
|
|
|
<Container>
|
|
|
|
<PublishingInfo
|
|
|
|
createdAt={document.createdAt}
|
|
|
|
createdBy={document.createdBy}
|
|
|
|
updatedAt={document.updatedAt}
|
|
|
|
updatedBy={document.updatedBy}
|
|
|
|
collaborators={toJS(document.collaborators)}
|
|
|
|
/>
|
|
|
|
<Link to={document.url}>
|
|
|
|
<h2>{document.title}</h2>
|
|
|
|
</Link>
|
|
|
|
<Markdown text={document.text.substring(0, 300)} />
|
|
|
|
<div>
|
|
|
|
<Link to={document.url}>
|
|
|
|
Continue reading…
|
2016-05-22 23:12:17 +00:00
|
|
|
</Link>
|
|
|
|
</div>
|
2017-05-25 07:07:41 +00:00
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
};
|
2016-05-20 16:02:39 +00:00
|
|
|
|
2017-05-25 07:07:41 +00:00
|
|
|
export default DocumentPreview;
|