2023-01-29 16:44:02 +01:00
|
|
|
// Hooks
|
|
|
|
import { useApp } from 'site/hooks/useApp.mjs'
|
|
|
|
// Dependencies
|
|
|
|
import Head from 'next/head'
|
2023-02-05 16:49:36 +01:00
|
|
|
import { mdxLoader } from 'shared/mdx/loader.mjs'
|
2023-01-29 16:44:02 +01:00
|
|
|
// Components
|
|
|
|
import { PageWrapper } from 'site/components/wrappers/page.mjs'
|
|
|
|
import { MdxWrapper } from 'shared/components/wrappers/mdx.mjs'
|
|
|
|
import { ReadMore } from 'shared/components/mdx/read-more.mjs'
|
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 })
|
2023-01-08 22:36:15 -08:00
|
|
|
const fullTitle = title + ' - FreeSewing.org'
|
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 (
|
2023-01-29 16:44:02 +01:00
|
|
|
<PageWrapper app={app} title={title}>
|
2023-01-08 22:36:15 -08:00
|
|
|
<Head>
|
|
|
|
<title>{fullTitle}</title>
|
|
|
|
</Head>
|
2022-06-10 12:25:56 +02:00
|
|
|
<div className="w-full">
|
|
|
|
<MdxWrapper mdx={mdx} app={app} components={components} />
|
|
|
|
</div>
|
2023-01-29 16:44:02 +01:00
|
|
|
</PageWrapper>
|
2022-06-10 12:25:56 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|