import { InView } from "react-intersection-observer";
import { NextSeo, ArticleJsonLd } from "next-seo";
import { MDXRemote, MDXRemoteProps } from "next-mdx-remote";
import Content from "../../components/Content";
import NoteMeta from "../../components/NoteMeta";
import Comments from "../../components/Comments";
import * as mdxComponents from "../../lib/helpers/mdx-components";
import { getNoteSlugs } from "../../lib/helpers/parse-notes";
import { compileNote } from "../../lib/helpers/compile-note";
import * as config from "../../lib/config";
import { articleJsonLd, favicons } from "../../lib/config/seo";
import type { GetStaticProps, GetStaticPaths } from "next";
import type { NoteWithSource, NoteFrontMatter } from "../../types";
const Note = ({ frontMatter, source }: NoteWithSource) => {
return (
<>
{!frontMatter.noComments && (
{({ inView, ref }) => (
)}
)}
>
);
};
export const getStaticProps: GetStaticProps = async ({ params }) => {
const { frontMatter, source } = await compileNote((params as Pick).slug);
return {
props: {
frontMatter,
source,
},
};
};
export const getStaticPaths: GetStaticPaths = async () => {
const slugs = await getNoteSlugs();
const paths = slugs.map((slug) => ({ params: { slug } }));
return {
paths,
fallback: false,
};
};
export default Note;