mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
update document title on drawer open/close
This commit is contained in:
parent
8185a34676
commit
7087e100ba
1 changed files with 30 additions and 8 deletions
|
|
@ -10,11 +10,33 @@ interface Props {
|
|||
list: List;
|
||||
};
|
||||
|
||||
export const ListDetailsDrawer = (props: RouteComponentProps & Props) =>
|
||||
<Drawer
|
||||
visible={true}
|
||||
onClose={() => props.history.push("/")}>
|
||||
<h2>{props.list.name}</h2>
|
||||
<Description {...props.list} />
|
||||
<SubscribeButton {...props.list} />
|
||||
</Drawer>;
|
||||
interface State {
|
||||
baseDocumentTitle: string;
|
||||
}
|
||||
|
||||
export class ListDetailsDrawer extends React.Component<RouteComponentProps & Props, State> {
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state = {
|
||||
baseDocumentTitle: document.title
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
document.title = this.props.list.name + " | " + this.state.baseDocumentTitle
|
||||
}
|
||||
|
||||
render() {
|
||||
return <Drawer
|
||||
visible={true}
|
||||
onClose={() => this.props.history.push("/")}>
|
||||
<h2>{this.props.list.name}</h2>
|
||||
<Description {...this.props.list} />
|
||||
<SubscribeButton {...this.props.list} />
|
||||
</Drawer>
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
document.title = this.state.baseDocumentTitle
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue