1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-09-19 22:15:53 +02:00
.profile/pages/_app.tsx

43 lines
1.2 KiB
TypeScript
Raw Normal View History

import { useEffect } from 'react'
2021-04-18 01:56:23 +02:00
import { AppProps } from 'next/app'
import { ThemeProvider } from 'next-themes'
2021-04-18 01:56:23 +02:00
import useTranslation from 'next-translate/useTranslation'
import UniversalCookie from 'universal-cookie'
import 'tailwindcss/tailwind.css'
2021-04-18 01:56:23 +02:00
import '@fontsource/montserrat/400.css'
import '@fontsource/montserrat/500.css'
import '@fontsource/montserrat/600.css'
import '@fontsource/montserrat/700.css'
import { Header } from 'components/Header'
import { Footer } from 'components/Footer'
const universalCookie = new UniversalCookie()
/** how long in seconds, until the cookie expires (10 years) */
const COOKIE_MAX_AGE = 10 * 365.25 * 24 * 60 * 60
const MyApp = ({ Component, pageProps }: AppProps): JSX.Element => {
const { lang } = useTranslation()
useEffect(() => {
universalCookie.set('NEXT_LOCALE', lang, {
path: '/',
maxAge: COOKIE_MAX_AGE
})
}, [lang])
return (
<ThemeProvider attribute='class' defaultTheme='dark'>
2021-04-18 01:56:23 +02:00
<Header />
<main className='flex flex-col md:mx-auto md:max-w-4xl lg:max-w-7xl'>
2021-04-18 01:56:23 +02:00
<Component {...pageProps} />
</main>
<Footer />
</ThemeProvider>
2021-04-18 01:56:23 +02:00
)
}
export default MyApp