gengitkan/client/src/components/Page.tsx

30 lines
529 B
TypeScript
Raw Normal View History

2019-11-28 14:12:48 +01:00
import React from 'react';
2019-12-01 22:12:13 +01:00
import { Navbar } from './Navbar';
2019-11-28 14:12:48 +01:00
2020-04-30 13:02:56 +02:00
export interface PageProps {
title?: string
}
export class Page extends React.PureComponent<PageProps> {
2019-11-28 14:12:48 +01:00
render() {
return (
2019-12-01 22:12:13 +01:00
<React.Fragment>
<Navbar />
{this.props.children}
</React.Fragment>
2019-11-28 14:12:48 +01:00
);
}
componentDidMount() {
this.updateTitle();
}
componentDidUpdate() {
this.updateTitle();
}
updateTitle() {
const { title } = this.props;
if (title !== undefined) window.document.title = title;
}
2019-11-28 14:12:48 +01:00
}