This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
website/pages/_app.tsx

44 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2021-10-24 05:19:39 +02:00
import { useEffect } from 'react'
2022-09-21 10:09:36 +02:00
import type { AppType } from 'next/app'
2021-10-24 05:48:06 +02:00
import { ThemeProvider } from 'next-themes'
2021-10-24 05:19:39 +02:00
import useTranslation from 'next-translate/useTranslation'
2022-03-16 12:18:09 +01:00
import '../styles/global.css'
2021-10-24 05:19:39 +02:00
2021-10-24 05:48:06 +02:00
import '@fontsource/montserrat/400.css'
import '@fontsource/montserrat/500.css'
import '@fontsource/montserrat/600.css'
import '@fontsource/montserrat/700.css'
2021-10-24 05:19:39 +02:00
import '@fontsource/roboto/400.css'
import '@fontsource/roboto/700.css'
2022-03-16 12:18:09 +01:00
import { cookies } from '../tools/cookies'
2021-10-24 05:48:06 +02:00
2022-09-21 10:09:36 +02:00
const Application: AppType = ({ Component, pageProps }) => {
2021-10-24 05:19:39 +02:00
const { lang } = useTranslation()
useEffect(() => {
cookies.set('NEXT_LOCALE', lang)
const appHeight = (): void => {
document.documentElement.style.setProperty(
'--app-height',
`${window.innerHeight}px`
)
}
window.addEventListener('resize', appHeight)
appHeight()
return () => {
window.removeEventListener('resize', appHeight)
}
2021-10-24 05:19:39 +02:00
}, [lang])
return (
2021-10-24 05:48:06 +02:00
<ThemeProvider attribute='class' defaultTheme='dark'>
<Component {...pageProps} />
</ThemeProvider>
2021-10-24 05:19:39 +02:00
)
}
2021-10-24 05:48:06 +02:00
export default Application