refactor: restructure project to classic MVC pattern
This commit is contained in:
18
src/composables/useNavigation.ts
Normal file
18
src/composables/useNavigation.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export function useNavigation() {
|
||||
function scrollToSection(sectionId: string) {
|
||||
const element = document.getElementById(sectionId)
|
||||
if (element) {
|
||||
const offset = 80 // Account for fixed header
|
||||
const elementPosition = element.offsetTop - offset
|
||||
|
||||
window.scrollTo({
|
||||
top: elementPosition,
|
||||
behavior: "smooth",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
scrollToSection,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user