mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 09:13:19 +01:00
project nav fixes
This commit is contained in:
parent
5cab4011b9
commit
eb0ed97293
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user