www-new/pages/_app.tsx

47 lines
1.4 KiB
TypeScript

import React, { ComponentType, ReactNode } from "react";
import { NextComponentType, NextPageContext } from "next";
import { AppProps as DefaultAppProps } from "next/app";
import { MDXProvider } from "@mdx-js/react";
import { ThemeProvider } from "../components/theme";
import { Navbar } from "../components/Navbar";
import { Footer } from "../components/Footer";
import { Link } from "../components/Link";
import { DefaultLayout } from "../components/DefaultLayout";
import styles from "./_app.module.css";
import "./_app.css";
import "./font.css";
export default function App({ Component, pageProps }: AppProps): JSX.Element {
const Layout = Component.Layout ?? DefaultLayout;
return (
<ThemeProvider theme="light">
<MDXProvider components={{ a: Link }}>
<div className={styles.appContainer}>
<Navbar />
{/* Wrapping content with a div to allow for a display: block parent */}
<div className={styles.contentContainer}>
<Layout>
<Component {...pageProps} />
</Layout>
</div>
<Footer />
</div>
</MDXProvider>
</ThemeProvider>
);
}
type PageComponent = NextComponentType<
NextPageContext,
unknown,
Record<string, unknown>
> & {
Layout?: ComponentType<{ children: ReactNode }>;
};
type AppProps = DefaultAppProps & {
Component: PageComponent;
};