HeaderAction
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import styles from './HeaderAction.scss';
|
||||||
|
|
||||||
|
const HeaderAction = (props) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
onClick={ props.onClick }
|
||||||
|
className={ styles.container }
|
||||||
|
>{ props.children }</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
HeaderAction.propTypes = {
|
||||||
|
onClick: React.PropTypes.func,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default HeaderAction;
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
min-height: 43px;
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
color: #0C77F8;
|
||||||
|
}
|
||||||
2
src/components/Layout/components/HeaderAction/index.js
Normal file
2
src/components/Layout/components/HeaderAction/index.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
import HeaderAction from './HeaderAction';
|
||||||
|
export default HeaderAction;
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import Layout from './Layout';
|
import Layout from './Layout';
|
||||||
import Title from './components/Title';
|
import Title from './components/Title';
|
||||||
import HeaderLink from './components/HeaderLink';
|
import HeaderAction from './components/HeaderAction';
|
||||||
|
|
||||||
export default Layout;
|
export default Layout;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Title,
|
Title,
|
||||||
HeaderLink,
|
HeaderAction,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { fetchAtlasAsync } from 'actions/AtlasActions';
|
|||||||
// Temp
|
// Temp
|
||||||
import { client } from 'utils/ApiClient';
|
import { client } from 'utils/ApiClient';
|
||||||
|
|
||||||
import Layout, { Title } from 'components/Layout';
|
import Layout, { Title, HeaderAction } from 'components/Layout';
|
||||||
import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
|
import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
|
||||||
import CenteredContent from 'components/CenteredContent';
|
import CenteredContent from 'components/CenteredContent';
|
||||||
import DocumentList from 'components/DocumentList';
|
import DocumentList from 'components/DocumentList';
|
||||||
@@ -35,7 +35,9 @@ class Atlas extends React.Component {
|
|||||||
let title;
|
let title;
|
||||||
|
|
||||||
if (!this.props.isLoading) {
|
if (!this.props.isLoading) {
|
||||||
actions = <Link to={ `/atlas/${atlas.id}/new` }>New document</Link>;
|
actions = <HeaderAction>
|
||||||
|
<Link to={ `/atlas/${atlas.id}/new` }>New document</Link>
|
||||||
|
</HeaderAction>;
|
||||||
title = <Title>{ atlas.name }</Title>;
|
title = <Title>{ atlas.name }</Title>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
deleteDocument,
|
deleteDocument,
|
||||||
} from 'actions/DocumentActions';
|
} from 'actions/DocumentActions';
|
||||||
|
|
||||||
import Layout, { HeaderLink } from 'components/Layout';
|
import Layout, { HeaderAction } from 'components/Layout';
|
||||||
import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
|
import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
|
||||||
import CenteredContent from 'components/CenteredContent';
|
import CenteredContent from 'components/CenteredContent';
|
||||||
import Document from 'components/Document';
|
import Document from 'components/Document';
|
||||||
@@ -55,9 +55,9 @@ class DocumentScene extends React.Component {
|
|||||||
if (document) {
|
if (document) {
|
||||||
actions = (
|
actions = (
|
||||||
<div className={ styles.actions }>
|
<div className={ styles.actions }>
|
||||||
<HeaderLink>
|
<HeaderAction>
|
||||||
<Link to={ `/documents/${document.id}/edit` }>Edit</Link>
|
<Link to={ `/documents/${document.id}/edit` }>Edit</Link>
|
||||||
</HeaderLink>
|
</HeaderAction>
|
||||||
<DropdownMenu label="More">
|
<DropdownMenu label="More">
|
||||||
<MenuItem onClick={ this.onDelete }>Delete</MenuItem>
|
<MenuItem onClick={ this.onDelete }>Delete</MenuItem>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
saveDocumentAsync,
|
saveDocumentAsync,
|
||||||
} from 'actions/DocumentActions';
|
} from 'actions/DocumentActions';
|
||||||
|
|
||||||
import Layout, { Title } from 'components/Layout';
|
import Layout, { Title, HeaderAction } from 'components/Layout';
|
||||||
import Flex from 'components/Flex';
|
import Flex from 'components/Flex';
|
||||||
import MarkdownEditor from 'components/MarkdownEditor';
|
import MarkdownEditor from 'components/MarkdownEditor';
|
||||||
import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
|
import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
|
||||||
@@ -63,9 +63,9 @@ class Editor extends Component {
|
|||||||
return (
|
return (
|
||||||
<Layout
|
<Layout
|
||||||
actions={(
|
actions={(
|
||||||
<Flex direction="row" align="center">
|
<HeaderAction>
|
||||||
<SaveAction onClick={ this.onSave } />
|
<SaveAction onClick={ this.onSave } />
|
||||||
</Flex>
|
</HeaderAction>
|
||||||
)}
|
)}
|
||||||
title={ title }
|
title={ title }
|
||||||
fixed={ true }
|
fixed={ true }
|
||||||
|
|||||||
Reference in New Issue
Block a user