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

63 lines
1.3 KiB
JavaScript
Raw Normal View History

2017-05-12 00:23:56 +00:00
// @flow
import React, { Component } from 'react';
2017-05-17 07:11:13 +00:00
import { Link } from 'react-router-dom';
2017-06-28 05:15:29 +00:00
import Document from 'models/Document';
import styled from 'styled-components';
import { color } from 'styles/constants';
2017-05-26 07:04:13 +00:00
import PublishingInfo from 'components/PublishingInfo';
type Props = {
document: Document,
2017-06-26 03:32:05 +00:00
highlight?: string,
innerRef?: Function,
};
const DocumentLink = styled(Link)`
display: block;
2017-06-26 03:32:05 +00:00
margin: 0 -16px;
padding: 16px;
border-radius: 8px;
border: 2px solid transparent;
max-height: 50vh;
min-width: 100%;
overflow: hidden;
&:hover,
&:active,
&:focus {
background: ${color.smokeLight};
border: 2px solid ${color.smoke};
outline: none;
}
&:focus {
border: 2px solid ${color.slateDark};
}
2017-06-26 03:32:05 +00:00
h3 {
margin-top: 0;
}
`;
class DocumentPreview extends Component {
props: Props;
render() {
const { document, innerRef, ...rest } = this.props;
return (
<DocumentLink to={document.url} innerRef={innerRef} {...rest}>
2017-06-26 03:32:05 +00:00
<h3>{document.title}</h3>
<PublishingInfo
createdAt={document.createdAt}
createdBy={document.createdBy}
updatedAt={document.updatedAt}
updatedBy={document.updatedBy}
/>
</DocumentLink>
);
}
}
export default DocumentPreview;