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.
outline/frontend/components/DocumentPreview/DocumentPreview.js

43 lines
1012 B
JavaScript
Raw Normal View History

2017-05-12 00:23:56 +00:00
// @flow
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';
import type { Document } from 'types';
import styled from 'styled-components';
2017-05-10 07:02:11 +00:00
import PublishingInfo from 'components/PublishingInfo';
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>
</Container>
);
};
export default DocumentPreview;