-
-
Notifications
You must be signed in to change notification settings - Fork 263
/
Copy path[slug].page.tsx
45 lines (43 loc) · 1.43 KB
/
[slug].page.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React from 'react';
import { getLayout } from '~/components/Sidebar';
import Head from 'next/head';
import StyledMarkdown from '~/components/StyledMarkdown';
import getStaticMarkdownPaths from '~/lib/getStaticMarkdownPaths';
import getStaticMarkdownProps from '~/lib/getStaticMarkdownProps';
import { Headline1 } from '~/components/Headlines';
import { SectionContext } from '~/context';
import { DocsHelp } from '~/components/DocsHelp';
import NextPrevButton from '~/components/NavigationButtons';
export async function getStaticPaths() {
return getStaticMarkdownPaths('pages');
}
export async function getStaticProps(args: any) {
return getStaticMarkdownProps(args, 'pages');
}
export default function StaticMarkdownPage({
frontmatter,
content,
}: {
frontmatter: any;
content: any;
}) {
const fileRenderType = '_md';
const newTitle = 'JSON Schema - ' + frontmatter.title;
return (
<SectionContext.Provider value={frontmatter.section || null}>
<Head>
<title>{newTitle}</title>
</Head>
<Headline1>{frontmatter.title}</Headline1>
<StyledMarkdown markdown={content} />
<NextPrevButton
prevLabel={frontmatter?.prev?.label}
prevURL={frontmatter?.prev?.url}
nextLabel={frontmatter?.next?.label}
nextURL={frontmatter?.next?.url}
/>
<DocsHelp fileRenderType={fileRenderType} />
</SectionContext.Provider>
);
}
StaticMarkdownPage.getLayout = getLayout;