2022-11-30 10:36:59 +00:00
|
|
|
import type { AppProps } from "next/app";
|
2022-12-16 09:14:47 +00:00
|
|
|
import { useRouter } from "next/router";
|
|
|
|
import React, { useMemo } from "react";
|
|
|
|
import { DefaultTheme, ThemeProvider } from "styled-components";
|
2022-12-14 15:39:51 +00:00
|
|
|
import ErrorBoundary from "../components/error-boundary";
|
2022-12-05 08:57:06 +00:00
|
|
|
|
|
|
|
import { GlobalStyle } from "../styles/global";
|
2022-12-16 09:14:47 +00:00
|
|
|
|
|
|
|
const homePageTheme: DefaultTheme = {
|
|
|
|
bgColor: "rgba(18, 18, 18, 1)",
|
|
|
|
bgGridColor: "rgba(51, 51, 51, 1)",
|
|
|
|
};
|
|
|
|
|
|
|
|
const defaultPageTheme: DefaultTheme = {
|
|
|
|
bgColor: "rgba(18, 18, 18, 0.8)",
|
|
|
|
bgGridColor: "rgba(51, 51, 51, 0.3)",
|
|
|
|
};
|
2022-11-30 08:11:45 +00:00
|
|
|
|
|
|
|
export default function App({ Component, pageProps }: AppProps) {
|
2022-12-16 09:14:47 +00:00
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
const pageTheme = useMemo(() => {
|
|
|
|
return router.pathname === "/" ? homePageTheme : defaultPageTheme;
|
|
|
|
}, [router.pathname]);
|
|
|
|
|
2022-12-05 08:57:06 +00:00
|
|
|
return (
|
2022-12-16 09:14:47 +00:00
|
|
|
<ThemeProvider theme={pageTheme}>
|
2022-12-16 08:32:08 +00:00
|
|
|
<React.Fragment>
|
|
|
|
<GlobalStyle />
|
|
|
|
<ErrorBoundary>
|
2022-12-16 09:21:35 +00:00
|
|
|
<Component {...pageProps} />
|
2022-12-16 08:32:08 +00:00
|
|
|
</ErrorBoundary>
|
|
|
|
</React.Fragment>
|
|
|
|
</ThemeProvider>
|
2022-12-05 08:57:06 +00:00
|
|
|
);
|
2022-11-30 08:11:45 +00:00
|
|
|
}
|