Tax Lawfirm Demo 1

This commit is contained in:
2025-07-01 01:31:16 +00:00
parent d60a5ecbb1
commit f14a2ac5ca
37 changed files with 8077 additions and 5 deletions

View File

@@ -0,0 +1,36 @@
'use client'
import {useEffect} from 'react'
export function useScrollTarget() {
const scrollToSection = (id: string) => {
if (id === 'top') {
window.scrollTo({top: 0, behavior: 'smooth'})
return
}
const el = document.getElementById(id)
if (el) {
el.scrollIntoView({behavior: 'smooth', block: 'start'})
}
}
const handleSectionClick = (id: string) => {
if (window.location.pathname !== '/') {
localStorage.setItem('scrollTarget', id)
window.location.href = '/'
} else {
scrollToSection(id)
}
}
useEffect(() => {
const target = localStorage.getItem('scrollTarget')
if (target) {
localStorage.removeItem('scrollTarget')
scrollToSection(target)
}
}, [])
return {scrollToSection, handleSectionClick}
}