mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
36 lines
789 B
TypeScript
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;
|