2
2
mirror of https://github.com/Thream/website.git synced 2024-07-21 09:28:32 +02:00
website/pages/_app.tsx

44 lines
1.1 KiB
TypeScript
Raw 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