diff --git a/src/components/Layout/Layout.js b/src/components/Layout/Layout.js
index 6200781a..876bf620 100644
--- a/src/components/Layout/Layout.js
+++ b/src/components/Layout/Layout.js
@@ -1,5 +1,4 @@
import React from 'react';
-import _truncate from 'lodash/truncate';
import { connect } from 'react-redux';
import Link from 'react-router/lib/Link';
@@ -11,7 +10,7 @@ import styles from './Layout.scss';
class Layout extends React.Component {
static propTypes = {
actions: React.PropTypes.node,
- title: React.PropTypes.string,
+ title: React.PropTypes.node,
}
render() {
@@ -22,11 +21,7 @@ class Layout extends React.Component {
{ this.props.teamName }
- { this.props.title ? (
- { _truncate(this.props.title, 60) }
- ) : (
- Untitled document
- )}
+ { this.props.title }
diff --git a/src/components/Layout/Layout.scss b/src/components/Layout/Layout.scss
index c7ff6aa4..91891ed5 100644
--- a/src/components/Layout/Layout.scss
+++ b/src/components/Layout/Layout.scss
@@ -33,15 +33,7 @@
justify-content: center;
}
-.title {
- color: #444;
-}
-
.actions a {
text-decoration: none;
margin-right: 15px;
}
-
-.untitled {
- color: #ccc;
-}
\ No newline at end of file
diff --git a/src/components/Layout/components/Title/Title.js b/src/components/Layout/components/Title/Title.js
new file mode 100644
index 00000000..7cadd640
--- /dev/null
+++ b/src/components/Layout/components/Title/Title.js
@@ -0,0 +1,38 @@
+import React from 'react';
+import _truncate from 'lodash/truncate';
+
+import styles from './Title.scss';
+import classNames from 'classnames/bind';
+const cx = classNames.bind(styles);
+
+const Title = (props) => {
+ let title;
+ if (props.truncate) {
+ title = _truncate(props.children, props.truncate);
+ } else {
+ title = props.children;
+ }
+
+ let usePlaceholder;
+ if (props.children === null && props.placeholder) {
+ title = props.placeholder;
+ usePlaceholder = true;
+ }
+
+ return(
+
+ { title }
+
+ );
+};
+
+Title.propTypes = {
+ children: React.PropTypes.string,
+ truncate: React.PropTypes.number,
+ placeholder: React.PropTypes.string,
+}
+
+export default Title;
\ No newline at end of file
diff --git a/src/components/Layout/components/Title/Title.scss b/src/components/Layout/components/Title/Title.scss
new file mode 100644
index 00000000..d7a2fa84
--- /dev/null
+++ b/src/components/Layout/components/Title/Title.scss
@@ -0,0 +1,7 @@
+.title {
+ color: #444;
+}
+
+.untitled {
+ color: #ccc;
+}
\ No newline at end of file
diff --git a/src/components/Layout/components/Title/index.js b/src/components/Layout/components/Title/index.js
new file mode 100644
index 00000000..8b8e12dd
--- /dev/null
+++ b/src/components/Layout/components/Title/index.js
@@ -0,0 +1,2 @@
+import Title from './Title';
+export default Title;
diff --git a/src/components/Layout/index.js b/src/components/Layout/index.js
index c396df43..82ecfc08 100644
--- a/src/components/Layout/index.js
+++ b/src/components/Layout/index.js
@@ -1,2 +1,8 @@
import Layout from './Layout';
-export default Layout;
\ No newline at end of file
+import Title from './components/Title';
+
+export default Layout;
+
+export {
+ Title,
+};
diff --git a/src/scenes/Atlas/Atlas.js b/src/scenes/Atlas/Atlas.js
index ee620a1f..64503619 100644
--- a/src/scenes/Atlas/Atlas.js
+++ b/src/scenes/Atlas/Atlas.js
@@ -8,7 +8,7 @@ import { fetchAtlasAsync } from 'actions/AtlasActions';
// Temp
import { client } from 'utils/ApiClient';
-import Layout from 'components/Layout';
+import Layout, { Title } from 'components/Layout';
import AtlasPreviewLoading from 'components/AtlasPreviewLoading';
import CenteredContent from 'components/CenteredContent';
@@ -49,7 +49,7 @@ class Atlas extends React.Component {
actions={(
New document
)}
- title={ data.name }
+ title={ { data.name } }
>
{ this.state.isLoading ? (
diff --git a/src/scenes/Editor/Editor.js b/src/scenes/Editor/Editor.js
index 0be9184a..c6dce865 100644
--- a/src/scenes/Editor/Editor.js
+++ b/src/scenes/Editor/Editor.js
@@ -10,7 +10,7 @@ import {
import styles from './Editor.scss';
import 'assets/styles/codemirror.css';
-import Layout from 'components/Layout';
+import Layout, { Title } from 'components/Layout';
import Flex from 'components/Flex';
import MarkdownEditor from 'components/MarkdownEditor';
@@ -26,6 +26,15 @@ class Editor extends Component {
}
render() {
+ let title = (
+
+ { this.props.title }
+
+ );
+
return (
)}
- title={ this.props.title }
+ title={ title }
>
-
-
-
+
);
}