guesstimate/client/src/components/Page.tsx

30 lines
548 B
TypeScript

import React from 'react';
import { Navbar } from './Navbar';
export interface PageProps {
title?: string
}
export class Page extends React.PureComponent<PageProps> {
render() {
return (
<React.Fragment>
<Navbar />
{this.props.children}
</React.Fragment>
);
}
componentDidMount() {
this.updateTitle();
}
componentDidUpdate() {
this.updateTitle();
}
updateTitle() {
const { title } = this.props;
if (title !== undefined) window.document.title = title + ' - Guesstimate';
}
}