This commit is contained in:
Jori Lallo
2016-06-05 23:57:58 -07:00
parent 95f69d9feb
commit ccab580aef
5 changed files with 32 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import Link from 'react-router/lib/Link'; import Link from 'react-router/lib/Link';
import Helmet from 'react-helmet';
import { observe } from 'mobx'; import { observe } from 'mobx';
import store from 'stores/UserStore'; import store from 'stores/UserStore';
@@ -17,6 +18,7 @@ class Layout extends React.Component {
static propTypes = { static propTypes = {
actions: React.PropTypes.node, actions: React.PropTypes.node,
title: React.PropTypes.node, title: React.PropTypes.node,
titleText: React.PropTypes.node,
fixed: React.PropTypes.bool, fixed: React.PropTypes.bool,
loading: React.PropTypes.bool, loading: React.PropTypes.bool,
} }
@@ -24,6 +26,14 @@ class Layout extends React.Component {
render() { render() {
return ( return (
<div className={ styles.container }> <div className={ styles.container }>
<Helmet
title={
this.props.titleText
? `${this.props.titleText} - Beautiful Atlas`
: 'Beautiful Atlas'
}
/>
{ this.props.loading ? ( { this.props.loading ? (
<LoadingIndicator /> <LoadingIndicator />
) : null } ) : null }

View File

@@ -30,6 +30,12 @@
} }
} }
.title {
a {
color: $textColor;
}
}
.teamName a { .teamName a {
font-family: 'Atlas Grotesk'; font-family: 'Atlas Grotesk';
font-weight: bold; font-weight: bold;

View File

@@ -24,18 +24,21 @@ class Atlas extends React.Component {
let actions; let actions;
let title; let title;
let titleText;
if (atlas) { if (atlas) {
actions = <HeaderAction> actions = <HeaderAction>
<Link to={ `/atlas/${atlas.id}/new` }>New document</Link> <Link to={ `/atlas/${atlas.id}/new` }>New document</Link>
</HeaderAction>; </HeaderAction>;
title = <Title>{ atlas.name }</Title>; title = <Title>{ atlas.name }</Title>;
titleText = atlas.name;
} }
return ( return (
<Layout <Layout
actions={ actions } actions={ actions }
title={ title } title={ title }
titleText={ titleText }
> >
<CenteredContent> <CenteredContent>
{ store.isFetching ? ( { store.isFetching ? (

View File

@@ -78,6 +78,9 @@ class DocumentEdit extends Component {
{ store.title } { store.title }
</Title> </Title>
); );
let titleText = store.title;
const actions = ( const actions = (
<Flex direction="row"> <Flex direction="row">
<HeaderAction> <HeaderAction>
@@ -101,6 +104,7 @@ class DocumentEdit extends Component {
<Layout <Layout
actions={ actions } actions={ actions }
title={ title } title={ title }
titleText={ titleText }
fixed={ true } fixed={ true }
loading={ store.isSaving } loading={ store.isSaving }
> >

View File

@@ -46,6 +46,7 @@ class DocumentScene extends React.Component {
render() { render() {
const doc = store.document; const doc = store.document;
let title; let title;
let titleText;
let actions; let actions;
if (doc) { if (doc) {
actions = ( actions = (
@@ -58,12 +59,19 @@ class DocumentScene extends React.Component {
</DropdownMenu> </DropdownMenu>
</div> </div>
); );
title = `${doc.atlas.name} - ${doc.title}`; title = (
<span>
<Link to={ `/atlas/${doc.atlas.id}` }>{doc.atlas.name}</Link>
{ ` / ${doc.title}` }
</span>
);
titleText = `${doc.atlas.name} - ${doc.title}`;
} }
return ( return (
<Layout <Layout
title={ title } title={ title }
titleText={ titleText }
actions={ actions } actions={ actions }
> >
<CenteredContent> <CenteredContent>