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:
parent
5cab4011b9
commit
eb0ed97293
@ -46,7 +46,7 @@ class ProjectNav extends Component {
|
|||||||
const currentWidth = current.clientWidth
|
const currentWidth = current.clientWidth
|
||||||
const finalPosition = currentLeft - window.innerWidth / 2 + currentWidth / 2
|
const finalPosition = currentLeft - window.innerWidth / 2 + currentWidth / 2
|
||||||
|
|
||||||
this.scrollContainer.scrollLeft = finalPosition
|
this.scrollContainer.scrollLeft += finalPosition
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -80,9 +80,7 @@ class ProjectNav extends Component {
|
|||||||
<FullWidth>
|
<FullWidth>
|
||||||
<nav
|
<nav
|
||||||
className={styles.projectNav}
|
className={styles.projectNav}
|
||||||
ref={node => {
|
ref={node => (this.scrollContainer = node)}
|
||||||
this.scrollContainer = node
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{projects.map(({ node }) => {
|
{projects.map(({ node }) => {
|
||||||
const current = node.slug === slug
|
const current = node.slug === slug
|
||||||
@ -91,9 +89,7 @@ class ProjectNav extends Component {
|
|||||||
<div
|
<div
|
||||||
className={styles.item}
|
className={styles.item}
|
||||||
key={node.slug}
|
key={node.slug}
|
||||||
ref={node => {
|
ref={node => current && (this.currentItem = node)}
|
||||||
if (current) this.currentItem = node
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<ProjectLink node={node} />
|
<ProjectLink node={node} />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user