diff --git a/packages/nextjs/pages/_app.tsx b/packages/nextjs/pages/_app.tsx index a0dc186..f083134 100644 --- a/packages/nextjs/pages/_app.tsx +++ b/packages/nextjs/pages/_app.tsx @@ -1,13 +1,12 @@ -import { useEffect, useState } from "react"; +import { ReactElement, ReactNode, useEffect, useState } from "react"; import type { AppProps } from "next/app"; import { RainbowKitProvider, darkTheme, lightTheme } from "@rainbow-me/rainbowkit"; import "@rainbow-me/rainbowkit/styles.css"; +import type { NextPage } from "next"; import NextNProgress from "nextjs-progressbar"; import { Toaster } from "react-hot-toast"; import { useDarkMode } from "usehooks-ts"; import { WagmiConfig } from "wagmi"; -import { Footer } from "~~/components/Footer"; -import { Header } from "~~/components/Header"; import { BlockieAvatar } from "~~/components/scaffold-eth"; import { useNativeCurrencyPrice } from "~~/hooks/scaffold-eth"; import { useGlobalState } from "~~/services/store/store"; @@ -15,7 +14,15 @@ import { wagmiConfig } from "~~/services/web3/wagmiConfig"; import { appChains } from "~~/services/web3/wagmiConnectors"; import "~~/styles/globals.css"; -const ScaffoldEthApp = ({ Component, pageProps }: AppProps) => { +export type NextPageWithLayout
, IP = P> = NextPage
& {
+ getLayout?: (page: ReactElement) => ReactNode;
+};
+
+type AppPropsWithLayout = AppProps & {
+ Component: NextPageWithLayout;
+};
+
+const ScaffoldEthApp = ({ Component, pageProps }: AppPropsWithLayout) => {
const price = useNativeCurrencyPrice();
const setNativeCurrencyPrice = useGlobalState(state => state.setNativeCurrencyPrice);
// This variable is required for initial client side rendering of correct theme for RainbowKit
@@ -32,6 +39,8 @@ const ScaffoldEthApp = ({ Component, pageProps }: AppProps) => {
setIsDarkTheme(isDarkMode);
}, [isDarkMode]);
+ const getLayout = Component.getLayout || (page => page);
+
return (