1
0
Fork 0
freesewing/sites/org/pages/docs/index.js

49 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-06-10 12:25:56 +02:00
import Page from 'site/components/wrappers/page.js'
import useApp from 'site/hooks/useApp.js'
import mdxLoader from 'shared/mdx/loader'
import MdxWrapper from 'shared/components/wrappers/mdx'
import ReadMore from 'shared/components/mdx/read-more.js'
2022-12-26 15:35:22 +01:00
import { jargon } from 'site/jargon.mjs'
2022-06-10 12:25:56 +02:00
2023-01-09 21:37:05 +01:00
const DocsPage = ({ title, mdx, bugsnag }) => {
const app = useApp({ bugsnag })
2022-06-10 12:25:56 +02:00
// We don't need all MDX components here, just ReadMore
const components = {
2022-12-03 11:25:02 -06:00
ReadMore: (props) => <ReadMore {...props} app={app} slug="docs" recurse />,
2022-06-10 12:25:56 +02:00
}
return (
<Page app={app} title={title}>
<div className="w-full">
<MdxWrapper mdx={mdx} app={app} components={components} />
</div>
</Page>
)
}
export default DocsPage
/*
* getStaticProps() is used to fetch data at build-time.
*
* On this page, it is loading the mdx (markdown) content
* from the markdown file on disk.
*
* This, in combination with getStaticPaths() below means this
* page will be used to render/generate all markdown/mdx content.
*
* To learn more, see: https://nextjs.org/docs/basic-features/data-fetching
*/
2022-12-03 11:25:02 -06:00
export async function getStaticProps({ locale }) {
2022-12-26 15:35:22 +01:00
const { mdx, frontmatter } = await mdxLoader(locale, 'org', ['docs'], jargon[locale])
2022-12-03 11:25:02 -06:00
const { title = 'FIXME: Please give this page a title' } = frontmatter
2022-06-10 12:25:56 +02:00
return {
props: {
mdx,
title,
2022-12-03 11:25:02 -06:00
},
2022-06-10 12:25:56 +02:00
}
}