refactor: change routing to astro
This commit is contained in:
41
src/views/HomePage.tsx
Normal file
41
src/views/HomePage.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Hero } from '../components/Hero'
|
||||
import { Services } from '../components/Services'
|
||||
import { Solutions } from '../components/Solutions'
|
||||
import { Cases } from '../components/Cases'
|
||||
import { About } from '../components/About'
|
||||
import { Contact } from '../components/Contact'
|
||||
import { ContactModal } from '../components/ContactModal'
|
||||
import { scrollToHashTarget } from '../lib/scrollToHash'
|
||||
|
||||
const HEADER_OFFSET_PX = 85
|
||||
|
||||
export function HomePage() {
|
||||
const [contactOpen, setContactOpen] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
const onHashChange = () => scrollToHashTarget(window.location.hash.slice(1))
|
||||
|
||||
onHashChange()
|
||||
window.addEventListener('hashchange', onHashChange)
|
||||
return () => window.removeEventListener('hashchange', onHashChange)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<Hero onOpenContactModal={() => setContactOpen(true)} />
|
||||
<Services />
|
||||
<Solutions />
|
||||
<div id="cases" style={{ scrollMarginTop: HEADER_OFFSET_PX }}>
|
||||
<Cases />
|
||||
</div>
|
||||
<div id="about" style={{ scrollMarginTop: HEADER_OFFSET_PX }}>
|
||||
<About />
|
||||
</div>
|
||||
<div id="contact" style={{ scrollMarginTop: HEADER_OFFSET_PX }}>
|
||||
<Contact />
|
||||
</div>
|
||||
<ContactModal isOpen={contactOpen} onClose={() => setContactOpen(false)} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user