From db6addcbe2c6f8aa571a4341717ad0565333a952 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sat, 23 Jun 2018 16:31:08 +0200 Subject: [PATCH] project nav tweaks --- src/components/molecules/ProjectNav.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/molecules/ProjectNav.jsx b/src/components/molecules/ProjectNav.jsx index 324f622..0708339 100644 --- a/src/components/molecules/ProjectNav.jsx +++ b/src/components/molecules/ProjectNav.jsx @@ -20,17 +20,26 @@ class ProjectNav extends Component { constructor(props) { super(props) + this.state = { + scrolledToCurrent: false + } + this.scrollToCurrent = this.scrollToCurrent.bind(this) } componentDidMount() { this.scrollToCurrent() + this.setState({ scrolledToCurrent: true }) } componentDidUpdate() { this.scrollToCurrent() } + componentWillUnmount() { + this.setState({ scrolledToCurrent: false }) + } + scrollToCurrent = () => { const current = this.currentItem const currentLeft = current.getBoundingClientRect().left