From 7087e100ba6551da7afb0bbd3908debdc137d262 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sun, 25 Aug 2019 17:19:57 -0500 Subject: [PATCH] update document title on drawer open/close --- .../src/components/ListDetailsDrawer.tsx | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/src/FilterLists.Web.V2/src/components/ListDetailsDrawer.tsx b/src/FilterLists.Web.V2/src/components/ListDetailsDrawer.tsx index d1d15f286..203937a1e 100644 --- a/src/FilterLists.Web.V2/src/components/ListDetailsDrawer.tsx +++ b/src/FilterLists.Web.V2/src/components/ListDetailsDrawer.tsx @@ -10,11 +10,33 @@ interface Props { list: List; }; -export const ListDetailsDrawer = (props: RouteComponentProps & Props) => - props.history.push("/")}> -

{props.list.name}

- - -
; \ No newline at end of file +interface State { + baseDocumentTitle: string; +} + +export class ListDetailsDrawer extends React.Component { + constructor(props: any) { + super(props); + this.state = { + baseDocumentTitle: document.title + }; + } + + componentDidMount() { + document.title = this.props.list.name + " | " + this.state.baseDocumentTitle + } + + render() { + return this.props.history.push("/")}> +

{this.props.list.name}

+ + +
+ } + + componentWillUnmount() { + document.title = this.state.baseDocumentTitle + } +} \ No newline at end of file