forked from json-schema-org/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.page.tsx
60 lines (56 loc) · 1.63 KB
/
index.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import React from 'react';
import fs from 'fs';
import { getLayout } from '~/components/Sidebar';
import Head from 'next/head';
import { Headline1 } from '~/components/Headlines';
import matter from 'gray-matter';
import StyledMarkdown from '~/components/StyledMarkdown';
import { SectionContext } from '~/context';
import { DocsHelp } from '~/components/DocsHelp';
import GettingStarted from '~/components/GettingStarted';
import NextPrevButton from '~/components/NavigationButtons';
export async function getStaticProps() {
const block1 = fs.readFileSync(
'pages/learn/getting-started-step-by-step/getting-started-step-by-step.md',
'utf-8',
);
const block2 = fs.readFileSync(
'pages/learn/getting-started-step-by-step/next-steps.md',
'utf-8',
);
const { content: block1Content } = matter(block1);
const { content: block2Content } = matter(block2);
return {
props: {
blocks: [block1Content, block2Content],
},
};
}
export default function StyledValidator({
blocks,
}: {
blocks: any[];
frontmatter: any;
content: any;
}) {
const newTitle = 'Creating your first schema';
return (
<SectionContext.Provider value='docs'>
<Head>
<title>{newTitle}</title>
</Head>
<Headline1>{newTitle}</Headline1>
<StyledMarkdown markdown={blocks[0]} />
<GettingStarted />
<StyledMarkdown markdown={blocks[1]} />
<NextPrevButton
prevLabel='Overview'
prevURL='/learn'
nextLabel='Miscellaneous examples'
nextURL='/learn/miscellaneous-examples'
/>
<DocsHelp />
</SectionContext.Provider>
);
}
StyledValidator.getLayout = getLayout;