1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-23 07:04:22 +00:00
festa/pages/_app.tsx

30 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-05-20 11:59:24 +00:00
import '../styles/globals.css'
import type { AppProps } from 'next/app'
2022-05-24 16:55:21 +00:00
import { LoginContext } from '../contexts/login'
2022-05-30 03:19:49 +00:00
import { useState } from 'react'
2022-05-26 14:32:11 +00:00
import defaultPostcard from "../public/postcards/adi-goldstein-Hli3R6LKibo-unsplash.jpg"
2022-05-24 16:55:21 +00:00
import { Postcard } from '../components/Postcard'
import { PostcardContext } from '../contexts/postcard'
import { StaticImageData } from 'next/image'
2022-05-25 14:20:22 +00:00
import { appWithTranslation } from 'next-i18next'
2022-05-29 02:01:56 +00:00
import { FestaLoginData } from '../types/user'
import {useStoredLogin} from "../hooks/useStoredLogin"
2022-05-27 00:46:30 +00:00
2022-05-20 11:59:24 +00:00
2022-05-25 14:20:22 +00:00
const App = ({ Component, pageProps }: AppProps): JSX.Element => {
2022-05-29 02:01:56 +00:00
const [login, setLogin] = useState<FestaLoginData | null>(null)
2022-05-27 00:46:30 +00:00
const [postcard, setPostcard] = useState<string | StaticImageData>(defaultPostcard)
2022-05-29 02:01:56 +00:00
useStoredLogin(setLogin)
2022-05-24 16:55:21 +00:00
return (
2022-05-27 00:46:30 +00:00
<PostcardContext.Provider value={[postcard, setPostcard]}>
<LoginContext.Provider value={[login, setLogin]}>
2022-05-24 16:55:21 +00:00
<Postcard/>
<Component {...pageProps} />
</LoginContext.Provider>
</PostcardContext.Provider>
)
2022-05-20 11:59:24 +00:00
}
2022-05-25 14:20:22 +00:00
export default appWithTranslation(App)