Skip to content

Commit

Permalink
feat: pass scroll position to portifolio/Header
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed Dec 22, 2022
1 parent 0839858 commit 711552b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/pages/portifolio.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect, useState } from 'react'
import { AboutSection } from 'src/components/portifolio/AboutSection'
import { ContactSection } from 'src/components/portifolio/ContactSection'
import { Header } from 'src/components/portifolio/Header'
Expand All @@ -6,9 +7,22 @@ import { KnowledgeSection } from 'src/components/portifolio/KnowledgeSection'
import { ProjectsSection } from 'src/components/portifolio/ProjectsSection'

function Portifolio() {
const [scrollPosition, setScrollPosition] = useState(0)

function updateScrollPosition() {
if (window) {
setScrollPosition(window.scrollY)
}
}

useEffect(() => {
if (window)
window.addEventListener('scroll', updateScrollPosition, { passive: true })
}, [])

return (
<div className="bg-neutral-1000 text-neutral-300">
<Header />
<Header scrollPosition={scrollPosition} />
<HomeSection />
<AboutSection />
<ProjectsSection />
Expand Down

0 comments on commit 711552b

Please sign in to comment.