diff --git a/frontend/components/DropToImport/DropToImport.js b/frontend/components/DropToImport/DropToImport.js index 944dde6f..b5a84100 100644 --- a/frontend/components/DropToImport/DropToImport.js +++ b/frontend/components/DropToImport/DropToImport.js @@ -96,10 +96,8 @@ class DropToImport extends Component { multiple {...props} > - - {this.state.isImporting && } - {this.props.children} - + {this.state.isImporting && } + {this.props.children} ); } diff --git a/frontend/components/Editor/Editor.js b/frontend/components/Editor/Editor.js index cd22cce5..0ba3055f 100644 --- a/frontend/components/Editor/Editor.js +++ b/frontend/components/Editor/Editor.js @@ -5,11 +5,13 @@ import { observer } from 'mobx-react'; import { Editor, Plain } from 'slate'; import classnames from 'classnames/bind'; import type { Document, State, Editor as EditorType } from './types'; +import Flex from 'components/Flex'; import ClickablePadding from './components/ClickablePadding'; import Toolbar from './components/Toolbar'; import Markdown from './serializer'; import createSchema from './schema'; import createPlugins from './plugins'; +import styled from 'styled-components'; import styles from './Editor.scss'; const cx = classnames.bind(styles); @@ -25,6 +27,7 @@ type Props = { onImageUploadStop: Function, starred: boolean, readOnly: boolean, + heading?: ?React.Element<*>, }; type KeyData = { @@ -116,7 +119,13 @@ type KeyData = { render = () => { return ( -
+ + + {this.props.heading} + {!this.props.readOnly && } -
+ ); }; } @@ -143,4 +152,15 @@ MarkdownEditor.childContextTypes = { starred: PropTypes.bool, }; +const Container = styled(Flex)` + height: 100%; +`; + +const HeaderContainer = styled(Flex).attrs({ + align: 'flex-end', +})` + height: 100px; + ${({ readOnly }) => !readOnly && 'cursor: text;'} +`; + export default MarkdownEditor; diff --git a/frontend/scenes/Document/Document.js b/frontend/scenes/Document/Document.js index 7b1ce0db..fa28558a 100644 --- a/frontend/scenes/Document/Document.js +++ b/frontend/scenes/Document/Document.js @@ -6,6 +6,7 @@ import { observer, inject } from 'mobx-react'; import { withRouter, Prompt } from 'react-router'; import Flex from 'components/Flex'; import { layout } from 'styles/constants'; +import invariant from 'invariant'; import Document from 'models/Document'; import UiStore from 'stores/UiStore'; @@ -135,6 +136,21 @@ type Props = { this.setState({ isDragging: false }); }; + renderHeading(isEditing: boolean) { + invariant(this.document, 'document not available'); + return ( + + + + ); + } + render() { const isNew = this.props.newDocument; const isEditing = this.props.match.params.edit || isNew; @@ -161,37 +177,28 @@ type Props = { onDragEnter={this.onStartDragging} onDragLeave={this.onStopDragging} onDrop={this.onStopDragging} + style={{ display: 'flex', flex: 1 }} > - + - - - - - - + @@ -207,7 +214,7 @@ type Props = { {!isEditing && } - + } ); @@ -228,22 +235,18 @@ const DropHere = styled(Flex)` const Meta = styled(Flex)` align-items: flex-start; - width: 100%; position: absolute; top: 0; + right: 0; padding: ${layout.padding}; `; -const Content = styled(Flex)` - margin-bottom: 20px; -`; - const InfoWrapper = styled(Flex)` opacity: ${({ visible }) => (visible ? '1' : '0')}; transition: all 100ms ease-in-out; `; -const Container = styled.div` +const Container = styled(Flex)` position: relative; width: 100%; `; @@ -252,11 +255,6 @@ const LoadingState = styled(PreviewLoading)` margin: 80px 20px; `; -const PagePadding = styled(Flex)` - padding: 80px 20px; - position: relative; -`; - const DocumentContainer = styled.div` font-weight: 400; font-size: 1em;