From e6e8d49d724fffff9874a525fbdc258d21715f56 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 17 May 2018 17:38:01 -0700 Subject: Close drawer when new path is chosen --- packages/website/ts/components/top_bar/top_bar.tsx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'packages/website/ts') diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 076f90b22..2c3273dee 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -95,6 +95,13 @@ export class TopBar extends React.Component { isDrawerOpen: false, }; } + public componentWillReceiveProps(nextProps: TopBarProps): void { + if (nextProps.location.pathname !== this.props.location.pathname) { + this.setState({ + isDrawerOpen: false, + }); + } + } public render(): React.ReactNode { const isNightVersion = this.props.isNightVersion; const isExpandedDisplayType = this.props.displayType === TopBarDisplayType.Expanded; -- cgit v1.2.3