Compare commits
No commits in common. "69402fd4c6dfb6e016d9a147836393bdcafa7a05" and "f1caef10587615e305ebc25adfcebee26ebeb6f6" have entirely different histories.
69402fd4c6
...
f1caef1058
|
|
@ -25,7 +25,7 @@ export function Nav({
|
|||
t: typeof translations.pl
|
||||
}) {
|
||||
const { theme, setTheme } = useTheme()
|
||||
const [activeSection] = useState<Sections>("about")
|
||||
const [activeSection, setActiveSection] = useState<Sections>("about")
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -44,8 +44,8 @@ export function Nav({
|
|||
entries.forEach(entry => {
|
||||
const target = entry.target.id as keyof (typeof translations.pl)["nav"]
|
||||
if (entry.isIntersecting) {
|
||||
// setActiveSection(target);
|
||||
if (history.replaceState) {
|
||||
setActiveSection(target);
|
||||
if (window.location.hash !== `#${target}` && history.replaceState) {
|
||||
timeout = setTimeout(() => {
|
||||
history.replaceState(null, "", `#${target}`)
|
||||
}, 150)
|
||||
|
|
|
|||
Loading…
Reference in a new issue