layout file

This commit is contained in:
Timur Ercan
2022-12-06 13:45:23 +01:00
parent 1e164090b3
commit f850729356
3 changed files with 39 additions and 78 deletions

View File

@ -1,6 +1,16 @@
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import { ReactElement, ReactNode } from "react";
import type { AppProps } from "next/app";
import { NextPage } from "next";
export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
export type NextPageWithLayout<P = {}, IP = P> = NextPage<P, IP> & {
getLayout?: (page: ReactElement) => ReactNode;
};
type AppPropsWithLayout = AppProps & {
Component: NextPageWithLayout;
};
export default function App({ Component, pageProps }: AppPropsWithLayout) {
const getLayout = Component.getLayout || ((page: any) => page);
return getLayout(<Component {...pageProps} />);
}