import { useEffect } from 'react'
import { Outlet, useLocation } from 'react-router-dom'
import Header from './Header'
import Footer from './Footer'

export default function Layout() {
  const { pathname } = useLocation()

  // Reset scroll on navigation between pages.
  useEffect(() => {
    window.scrollTo(0, 0)
  }, [pathname])

  return (
    <div style={{ background: '#F4F6FA', color: '#0A2540' }}>
      <Header />
      <Outlet />
      <Footer />
    </div>
  )
}
