Cleanup, document menu

This commit is contained in:
Tom Moor
2017-09-04 14:23:08 -07:00
parent 98eed483c4
commit e72d33e4ec
6 changed files with 31 additions and 41 deletions

View File

@ -36,7 +36,6 @@ const Collaborators = function({ document }: { document: Document }) {
const Avatars = styled(Flex)` const Avatars = styled(Flex)`
flex-direction: row-reverse; flex-direction: row-reverse;
margin-right: 10px;
height: 26px; height: 26px;
`; `;

View File

@ -1,16 +0,0 @@
// @flow
import React from 'react';
import styles from './HeaderAction.scss';
type Props = { onClick?: ?Function, children?: ?React.Element<any> };
const HeaderAction = (props: Props) => {
return (
<div onClick={props.onClick} className={styles.container}>
{props.children}
</div>
);
};
export default HeaderAction;

View File

@ -1,11 +0,0 @@
.container {
display: flex;
justify-content: center;
align-items: center;
min-height: 43px;
padding: 0 0.5rem;
a {
color: #171B35;
}
}

View File

@ -1,3 +0,0 @@
// @flow
import HeaderAction from './HeaderAction';
export default HeaderAction;

View File

@ -1,8 +1,7 @@
// @flow // @flow
import Layout from './Layout'; import Layout from './Layout';
import Title from './components/Title'; import Title from './components/Title';
import HeaderAction from './components/HeaderAction';
export default Layout; export default Layout;
export { Title, HeaderAction }; export { Title };

View File

@ -5,7 +5,7 @@ import styled from 'styled-components';
import { observer, inject } from 'mobx-react'; import { observer, inject } from 'mobx-react';
import { withRouter, Prompt } from 'react-router'; import { withRouter, Prompt } from 'react-router';
import Flex from 'components/Flex'; import Flex from 'components/Flex';
import { layout } from 'styles/constants'; import { color, layout } from 'styles/constants';
import Document from 'models/Document'; import Document from 'models/Document';
import UiStore from 'stores/UiStore'; import UiStore from 'stores/UiStore';
@ -13,9 +13,10 @@ import DocumentsStore from 'stores/DocumentsStore';
import Menu from './components/Menu'; import Menu from './components/Menu';
import SaveAction from './components/SaveAction'; import SaveAction from './components/SaveAction';
import LoadingPlaceholder from 'components/LoadingPlaceholder'; import LoadingPlaceholder from 'components/LoadingPlaceholder';
import Button from 'components/Button';
import Editor from 'components/Editor'; import Editor from 'components/Editor';
import Icon from 'components/Icon';
import DropToImport from 'components/DropToImport'; import DropToImport from 'components/DropToImport';
import { HeaderAction } from 'components/Layout';
import LoadingIndicator from 'components/LoadingIndicator'; import LoadingIndicator from 'components/LoadingIndicator';
import Collaborators from 'components/Collaborators'; import Collaborators from 'components/Collaborators';
import CenteredContent from 'components/CenteredContent'; import CenteredContent from 'components/CenteredContent';
@ -215,13 +216,22 @@ type Props = {
} }
isNew={!!isNew} isNew={!!isNew}
/> />
: <a onClick={this.onClickEdit}>Edit</a>} : <a onClick={this.onClickEdit}>
<Icon type="Edit2" /> Edit
</a>}
</HeaderAction>
<HeaderAction>
{isEditing
? undefined
: <a onClick={this.onClickEdit}>
<Icon type="Plus" /> New
</a>}
</HeaderAction>
<HeaderAction>
{isEditing
? <a onClick={this.onCancel}>Cancel</a>
: <Menu document={document} />}
</HeaderAction> </HeaderAction>
{isEditing &&
<HeaderAction>
<a onClick={this.onCancel}>Cancel</a>
</HeaderAction>}
{!isEditing && <Menu document={document} />}
</Flex> </Flex>
</Meta> </Meta>
</Flex> </Flex>
@ -231,6 +241,18 @@ type Props = {
} }
} }
const HeaderAction = styled(Flex)`
justify-content: center;
align-items: center;
min-height: 43px;
color: ${color.text};
padding: 0 0 0 16px;
a {
color: ${color.text};
}
`;
const DropHere = styled(Flex)` const DropHere = styled(Flex)`
pointer-events: none; pointer-events: none;
position: fixed; position: fixed;