import fs from "fs"; import { NextPage } from "next"; import Head from "next/head"; import Link from "next/link"; import path from "path"; import { inferSSRProps } from "@lib/types/inferSSRProps"; async function _getStaticProps() { const dir = path.join(process.cwd(), "pages", "sandbox"); const pages = fs .readdirSync(dir) .filter((file) => !file.startsWith(".")) .map((file) => { const parts = file.split("."); // remove extension parts.pop(); return parts.join("."); }); return { props: { pages, }, }; } type PageProps = inferSSRProps; const SandboxPage: NextPage = (props) => { return ( <>
{props.children}
); }; export function sandboxPage(Component: NextPage) { const Wrapper: NextPage = (props) => { return ( <> ); }; return { default: Wrapper, getStaticProps: _getStaticProps, }; } const page = sandboxPage(() => { return

Click a component above

; }); export default page.default; export const getStaticProps = page.getStaticProps;