From 09f1dbd60744ffa4810f32f1c9bb2d505627ee04 Mon Sep 17 00:00:00 2001
From: 3zachm <3zachm2@gmail.com>
Date: Thu, 8 Dec 2022 07:01:43 -0800
Subject: [PATCH] use layouts
---
pages/_app.tsx | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
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
= 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(