Make each admin page specify is own layout. Closes #2584
This commit is contained in:
@@ -14,9 +14,6 @@ import { AppProps } from 'next/app';
|
||||
import { ReactElement, ReactNode } from 'react';
|
||||
import { NextPage } from 'next';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
import { Router, useRouter } from 'next/router';
|
||||
|
||||
import { AdminLayout } from '../components/layouts/AdminLayout';
|
||||
|
||||
export type NextPageWithLayout<P = {}, IP = P> = NextPage<P, IP> & {
|
||||
getLayout?: (page: ReactElement) => ReactNode;
|
||||
@@ -27,12 +24,6 @@ type AppPropsWithLayout = AppProps & {
|
||||
};
|
||||
|
||||
export default function App({ Component, pageProps }: AppPropsWithLayout) {
|
||||
const router = useRouter() as Router;
|
||||
const isAdminPage = router.pathname.startsWith('/admin');
|
||||
if (isAdminPage) {
|
||||
return <AdminLayout pageProps={pageProps} Component={Component} router={router} />;
|
||||
}
|
||||
|
||||
const layout = Component.getLayout ?? (page => page);
|
||||
|
||||
return layout(
|
||||
|
||||
Reference in New Issue
Block a user