1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-22 17:23:22 +01:00

project nav fixes

This commit is contained in:
Matthias Kretschmann 2018-07-10 17:06:38 +02:00
parent 5cab4011b9
commit eb0ed97293
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -46,7 +46,7 @@ class ProjectNav extends Component {
const currentWidth = current.clientWidth
const finalPosition = currentLeft - window.innerWidth / 2 + currentWidth / 2
this.scrollContainer.scrollLeft = finalPosition
this.scrollContainer.scrollLeft += finalPosition
}
render() {
@ -80,9 +80,7 @@ class ProjectNav extends Component {
<FullWidth>
<nav
className={styles.projectNav}
ref={node => {
this.scrollContainer = node
}}
ref={node => (this.scrollContainer = node)}
>
{projects.map(({ node }) => {
const current = node.slug === slug
@ -91,9 +89,7 @@ class ProjectNav extends Component {
<div
className={styles.item}
key={node.slug}
ref={node => {
if (current) this.currentItem = node
}}
ref={node => current && (this.currentItem = node)}
>
<ProjectLink node={node} />
</div>