2021-02-05 09:09:42 +00:00
|
|
|
import 'swiper/swiper-bundle.min.css'
|
2021-02-17 17:56:05 +00:00
|
|
|
import '../styles/global.css'
|
2021-02-05 09:09:42 +00:00
|
|
|
|
2021-02-08 09:48:38 +00:00
|
|
|
import Layout from '../components/Layout'
|
|
|
|
import Footer from '../components/Footer'
|
|
|
|
import Header from '../components/Header'
|
2021-02-12 10:23:24 +00:00
|
|
|
import { useRouter } from 'next/router'
|
|
|
|
import { useEffect } from 'react'
|
2021-03-30 18:34:40 +00:00
|
|
|
import { IntlProvider } from 'react-intl'
|
2021-02-12 10:23:24 +00:00
|
|
|
import { pageview } from '../components/gtag'
|
2021-04-23 13:52:13 +00:00
|
|
|
import messages, { Languages } from '../content/locale/'
|
|
|
|
import { AppProps } from 'next/app'
|
2023-03-27 08:25:28 +00:00
|
|
|
import { Poppins } from 'next/font/google'
|
|
|
|
|
|
|
|
const poppins = Poppins({
|
|
|
|
weight: '400',
|
|
|
|
style: 'normal',
|
|
|
|
subsets: ['latin'],
|
|
|
|
})
|
2021-02-08 09:48:38 +00:00
|
|
|
|
2021-09-09 17:57:04 +00:00
|
|
|
export default function App({ Component, pageProps }: AppProps) {
|
2021-02-17 17:56:05 +00:00
|
|
|
const router = useRouter()
|
2021-04-23 13:52:13 +00:00
|
|
|
const { locale = 'sv', defaultLocale } = router
|
2021-03-29 19:23:37 +00:00
|
|
|
|
2021-04-23 13:52:13 +00:00
|
|
|
const currentMessages = messages[locale as Languages]
|
2021-02-12 10:23:24 +00:00
|
|
|
|
|
|
|
// Google analytics
|
|
|
|
useEffect(() => {
|
2021-04-23 13:52:13 +00:00
|
|
|
const handleRouteChange = (url: string) => pageview(url)
|
|
|
|
|
2021-02-12 10:23:24 +00:00
|
|
|
router.events.on('routeChangeComplete', handleRouteChange)
|
|
|
|
return () => {
|
|
|
|
router.events.off('routeChangeComplete', handleRouteChange)
|
|
|
|
}
|
|
|
|
}, [router.events])
|
|
|
|
|
2021-02-08 09:48:38 +00:00
|
|
|
return (
|
2021-03-30 18:34:40 +00:00
|
|
|
<IntlProvider
|
|
|
|
locale={locale}
|
|
|
|
defaultLocale={defaultLocale}
|
|
|
|
messages={currentMessages}
|
|
|
|
>
|
2023-03-27 08:25:28 +00:00
|
|
|
<style jsx global>{`
|
|
|
|
html {
|
|
|
|
font-family: ${poppins.style.fontFamily};
|
|
|
|
}
|
|
|
|
`}</style>
|
2021-03-29 19:23:37 +00:00
|
|
|
<Layout pageTitle="Skolplattformen">
|
|
|
|
<Header />
|
|
|
|
<Component {...pageProps} />
|
|
|
|
<Footer />
|
|
|
|
</Layout>
|
|
|
|
</IntlProvider>
|
2021-02-08 09:48:38 +00:00
|
|
|
)
|
2021-02-05 09:09:42 +00:00
|
|
|
}
|