2021-05-08 19:52:04 +02:00
|
|
|
import { useEffect } from 'react'
|
2021-04-18 01:56:23 +02:00
|
|
|
import { AppProps } from 'next/app'
|
2021-05-08 19:52:04 +02:00
|
|
|
import { ThemeProvider } from 'next-themes'
|
2021-04-18 01:56:23 +02:00
|
|
|
import useTranslation from 'next-translate/useTranslation'
|
|
|
|
import UniversalCookie from 'universal-cookie'
|
|
|
|
|
2021-05-08 19:52:04 +02:00
|
|
|
import 'tailwindcss/tailwind.css'
|
2021-04-18 01:56:23 +02:00
|
|
|
import '@fontsource/montserrat/400.css'
|
|
|
|
import '@fontsource/montserrat/600.css'
|
|
|
|
|
|
|
|
const universalCookie = new UniversalCookie()
|
|
|
|
|
|
|
|
/** how long in seconds, until the cookie expires (10 years) */
|
|
|
|
const COOKIE_MAX_AGE = 10 * 365.25 * 24 * 60 * 60
|
|
|
|
|
2021-09-09 10:08:42 +02:00
|
|
|
const Application = ({ Component, pageProps }: AppProps): JSX.Element => {
|
2021-04-18 01:56:23 +02:00
|
|
|
const { lang } = useTranslation()
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
universalCookie.set('NEXT_LOCALE', lang, {
|
|
|
|
path: '/',
|
|
|
|
maxAge: COOKIE_MAX_AGE
|
|
|
|
})
|
|
|
|
}, [lang])
|
|
|
|
|
|
|
|
return (
|
2021-05-08 19:52:04 +02:00
|
|
|
<ThemeProvider attribute='class' defaultTheme='dark'>
|
2021-07-27 13:36:35 +02:00
|
|
|
<Component {...pageProps} />
|
2021-05-08 19:52:04 +02:00
|
|
|
</ThemeProvider>
|
2021-04-18 01:56:23 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-09-09 10:08:42 +02:00
|
|
|
export default Application
|