import { createRouter, createWebHistory } from 'vue-router'
import HomePage from '../views/HomePage.vue'
import ProfilePage from '../views/ProfilePage.vue'
import ContactPage from '../views/ContactPage.vue'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    { path: '/', name: 'home', component: HomePage },
    { path: '/profile', name: 'profile', component: ProfilePage },
    { path: '/contact', name: 'contact', component: ContactPage },
  ],
  scrollBehavior(to) {
    if (to.hash) {
      return { el: to.hash, top: 70, behavior: 'smooth' }
    }
    return { top: 0 }
  },
})

export default router
