From e9a1dc63d77eb1a345b776f6bd92f9c882b48b81 Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Sun, 2 Jul 2017 15:26:24 -0500 Subject: [PATCH] New published info location and author info --- frontend/components/AuthorInfo/AuthorInfo.js | 42 ++++++++++++++++++ frontend/components/AuthorInfo/index.js | 3 ++ frontend/scenes/Document/Document.js | 45 +++++++++++--------- 3 files changed, 71 insertions(+), 19 deletions(-) create mode 100644 frontend/components/AuthorInfo/AuthorInfo.js create mode 100644 frontend/components/AuthorInfo/index.js diff --git a/frontend/components/AuthorInfo/AuthorInfo.js b/frontend/components/AuthorInfo/AuthorInfo.js new file mode 100644 index 00000000..597ec1b9 --- /dev/null +++ b/frontend/components/AuthorInfo/AuthorInfo.js @@ -0,0 +1,42 @@ +// @flow +import React, { Component } from 'react'; +import styled from 'styled-components'; +import type { User } from 'types'; +import { Flex } from 'reflexbox'; + +const Container = styled(Flex)` + justify-content: space-between; + color: #bbb; + font-size: 13px; +`; + +class AuthorInfo extends Component { + props: { + collaborators: Array, + views: number, + }; + + render() { + const { collaborators, views } = this.props; + + const users = collaborators.map((user, index, arr) => ( + + {user.name} {arr.length > 1 && (index < arr.length - 1 ? ',' : 'and')} + + )); + + return ( + + Recently edited by + {' '} + {users} + {' '} + and viewed + {` ${views} `} + times. + + ); + } +} + +export default AuthorInfo; diff --git a/frontend/components/AuthorInfo/index.js b/frontend/components/AuthorInfo/index.js new file mode 100644 index 00000000..3ab299aa --- /dev/null +++ b/frontend/components/AuthorInfo/index.js @@ -0,0 +1,3 @@ +// @flow +import AuthorInfo from './AuthorInfo'; +export default AuthorInfo; diff --git a/frontend/scenes/Document/Document.js b/frontend/scenes/Document/Document.js index 128cadd8..db5d81bb 100644 --- a/frontend/scenes/Document/Document.js +++ b/frontend/scenes/Document/Document.js @@ -13,7 +13,7 @@ import Editor from 'components/Editor'; import { HeaderAction, SaveAction } from 'components/Layout'; import LoadingIndicator from 'components/LoadingIndicator'; import PublishingInfo from 'components/PublishingInfo'; -import DocumentViews from 'components/DocumentViews'; +import AuthorInfo from 'components/AuthorInfo'; import PreviewLoading from 'components/PreviewLoading'; import CenteredContent from 'components/CenteredContent'; import PageTitle from 'components/PageTitle'; @@ -142,26 +142,29 @@ type Props = { updatedBy={this.document.updatedBy} /> - + + + + + + - {!isEditing && - } {isEditing @@ -190,6 +193,10 @@ const Meta = styled(Flex)` padding: 10px 20px; `; +const Content = styled(Flex)` + margin-bottom: 20px; +`; + const InfoWrapper = styled(Flex)` opacity: ${({ visible }) => (visible ? '1' : '0')}; transition: all 100ms ease-in-out;