diff options
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/_app.tsx | 7 | ||||
| -rw-r--r-- | src/pages/index.tsx | 10 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 6f08a02..8194b10 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,8 +1,9 @@ +import { AppPropsWithLayout } from '@ts/types/app'; import '../styles/globals.scss'; -import type { AppProps } from 'next/app'; -function MyApp({ Component, pageProps }: AppProps) { - return <Component {...pageProps} />; +function MyApp({ Component, pageProps }: AppPropsWithLayout) { + const getLayout = Component.getLayout ?? ((page) => page); + return getLayout(<Component {...pageProps} />); } export default MyApp; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index da31f7d..6022497 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,9 +1,11 @@ -import type { NextPage } from 'next'; +import Layout from '@components/Layouts/Layout'; +import { NextPageWithLayout } from '@ts/types/app'; import Head from 'next/head'; import Image from 'next/image'; +import type { ReactElement } from 'react'; import styles from '../styles/Home.module.css'; -const Home: NextPage = () => { +const Home: NextPageWithLayout = () => { return ( <div className={styles.container}> <Head> @@ -69,4 +71,8 @@ const Home: NextPage = () => { ); }; +Home.getLayout = function getLayout(page: ReactElement) { + return <Layout>{page}</Layout>; +}; + export default Home; |
