jackmerrill.com/pages/_app.tsx

44 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-04-13 19:39:58 -07:00
import React, { useEffect, useState } from 'react'
2021-03-30 22:27:36 -07:00
import { AppProps } from 'next/app'
2021-04-14 09:06:15 -07:00
import SEO from '../next-seo.config';
import { DefaultSeo } from 'next-seo';
2021-03-30 22:27:36 -07:00
import 'tailwindcss/tailwind.css'
2021-04-13 19:39:58 -07:00
import { useRouter } from 'next/dist/client/router';
import Footer from '../components/Footer';
2021-03-30 22:27:36 -07:00
function MyApp({ Component, pageProps }: AppProps) {
2021-04-13 19:39:58 -07:00
const router = useRouter();
const [loading, setLoading] = useState(false);
useEffect(() => {
const handleStart = () => {
setLoading(true);
}
const handleComplete = () => {
setTimeout(() => setLoading(false), 300)
}
router.events.on('routeChangeStart', handleStart)
router.events.on('routeChangeComplete', handleComplete)
router.events.on('routeChangeError', handleComplete)
})
return <>
<div id='app'>
2021-10-04 15:13:53 -07:00
<main className="bg-black w-full h-full min-h-screen">
2021-04-14 09:06:15 -07:00
<DefaultSeo {...SEO}/>
2021-04-13 19:39:58 -07:00
<Component {...pageProps} />
<Footer />
</main>
2021-10-04 15:13:53 -07:00
<style jsx global>{`
2021-09-07 10:14:50 -07:00
html, body {
scroll-behavior: smooth;
}
`}</style>
2021-04-13 19:39:58 -07:00
</div>
</>
2021-03-30 22:27:36 -07:00
}
export default MyApp