diff --git a/pages/_app.tsx b/pages/_app.tsx index e6f7c5c..c6d8054 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,6 +1,19 @@ import "../styles/globals.css"; +import type { ReactElement, ReactNode } from "react"; +import type { NextPage } from "next"; import type { AppProps } from "next/app"; -export default function App({ Component, pageProps }: AppProps) { - return ; +export type NextPageWithLayout

= NextPage & { + getLayout?: (page: ReactElement) => ReactNode; +}; + +type AppPropsWithLayout = AppProps & { + Component: NextPageWithLayout; +}; + +export default function App({ Component, pageProps }: AppPropsWithLayout) { + // Use the layout defined at the page level, if available + const getLayout = Component.getLayout ?? ((page) => page); + + return getLayout(); }