You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
647 B
TypeScript
21 lines
647 B
TypeScript
// Scroll suave para uma âncora de secção (compensado pelo header fixo via scroll-mt).
|
|
export function scrollToSection(id: string) {
|
|
const el = document.getElementById(id)
|
|
if (!el) return
|
|
const prefersReduced = window.matchMedia(
|
|
"(prefers-reduced-motion: reduce)"
|
|
).matches
|
|
el.scrollIntoView({
|
|
behavior: prefersReduced ? "auto" : "smooth",
|
|
block: "start",
|
|
})
|
|
// Atualiza o hash sem dar o salto nativo do browser.
|
|
history.replaceState(null, "", `#${id}`)
|
|
}
|
|
|
|
export const navItems = [
|
|
{ id: "home", label: "Home" },
|
|
{ id: "work-plan", label: "Work plan" },
|
|
{ id: "indicators", label: "Indicators" },
|
|
] as const
|