Files
DefectingCat.github.io/pages/g/[id].tsx
2022-04-24 17:46:43 +08:00

36 lines
789 B
TypeScript

import { GetStaticProps, InferGetStaticPropsType, GetStaticPaths } from 'next';
import dynamic from 'next/dynamic';
import { ReactElement } from 'react';
const MainLayout = dynamic(() => import('layouts/MainLayout'));
const Gist = ({ id }: InferGetStaticPropsType<typeof getStaticProps>) => {
return (
<>
<main className="max-w-5xl px-4 mx-auto lg:px-0">{id}</main>
</>
);
};
export const getStaticPaths: GetStaticPaths = async () => {
return {
paths: [],
fallback: true,
};
};
export const getStaticProps: GetStaticProps = async ({ params }) => {
return {
props: {
id: params?.id,
},
revalidate: 60,
};
};
Gist.getLayout = function getLayout(page: ReactElement) {
return <MainLayout>{page}</MainLayout>;
};
export default Gist;