Update document title via Page component

This commit is contained in:
wpetit 2019-12-05 22:46:07 +01:00
parent a7297e3d12
commit 29f44f8c75
3 changed files with 16 additions and 2 deletions

View File

@ -33,8 +33,9 @@ export class BoardPage extends React.Component {
} }
render() { render() {
const { board } = this.props;
return ( return (
<Page> <Page title={`${board ? (board.title + ' - ') : ''}GenGitKan`}>
<div className="container is-fluid"> <div className="container is-fluid">
{this.renderBoard()} {this.renderBoard()}
</div> </div>

View File

@ -9,7 +9,7 @@ import { selectBoardByUserProjects } from '../../store/selectors/boards';
export class HomePage extends React.Component { export class HomePage extends React.Component {
render() { render() {
return ( return (
<Page> <Page title="GenGitKan - Accueil">
<div className="container is-fluid"> <div className="container is-fluid">
<div className="level has-margin-top-normal"> <div className="level has-margin-top-normal">
<div className="level-left"></div> <div className="level-left"></div>

View File

@ -10,4 +10,17 @@ export class Page extends React.PureComponent {
</React.Fragment> </React.Fragment>
); );
} }
componentDidMount() {
this.updateTitle();
}
componentDidUpdate() {
this.updateTitle();
}
updateTitle() {
const { title } = this.props;
if (title !== undefined) window.document.title = title;
}
} }