2023-07-04 13:28:46 -05:00
|
|
|
import {
|
|
|
|
SanityPageWrapper,
|
|
|
|
getSanityStaticPaths,
|
|
|
|
ns as sanityNs,
|
|
|
|
} from 'site/components/sanity/page-wrapper.mjs'
|
2023-06-19 16:27:13 -05:00
|
|
|
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
2023-07-17 20:10:08 -05:00
|
|
|
import { useDynamicMdx } from 'shared/hooks/use-dynamic-mdx.mjs'
|
|
|
|
import { useCallback } from 'react'
|
2023-06-19 16:27:13 -05:00
|
|
|
|
|
|
|
const namespaces = [...sanityNs]
|
|
|
|
|
2023-07-17 20:10:08 -05:00
|
|
|
const ShowcasePage = ({ locale, slug, page }) => {
|
|
|
|
const loader = useCallback(
|
|
|
|
() => import(`orgmarkdown/showcase/${slug}/${locale}.md`),
|
|
|
|
[slug, locale]
|
|
|
|
)
|
|
|
|
|
|
|
|
const { frontmatter, MDX } = useDynamicMdx(loader)
|
|
|
|
if (!MDX) return null
|
|
|
|
return (
|
|
|
|
<SanityPageWrapper
|
|
|
|
{...{
|
|
|
|
frontmatter,
|
|
|
|
MDX,
|
|
|
|
namespaces,
|
|
|
|
page,
|
|
|
|
slug,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
2023-06-19 16:27:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* getStaticProps() is used to fetch data at build-time.
|
|
|
|
*
|
|
|
|
* On this page, it is loading the showcase content from strapi.
|
|
|
|
*
|
|
|
|
* This, in combination with getStaticPaths() below means this
|
|
|
|
* page will be used to render/generate all showcase content.
|
|
|
|
*
|
|
|
|
* To learn more, see: https://nextjs.org/docs/basic-features/data-fetching
|
|
|
|
*/
|
|
|
|
export async function getStaticProps({ params, locale }) {
|
|
|
|
const { slug } = params
|
|
|
|
|
|
|
|
return {
|
|
|
|
props: {
|
2023-07-17 20:10:08 -05:00
|
|
|
slug,
|
|
|
|
locale,
|
2023-06-19 16:27:13 -05:00
|
|
|
...(await serverSideTranslations(locale, namespaces)),
|
2023-07-03 13:28:41 -05:00
|
|
|
page: {
|
|
|
|
locale,
|
|
|
|
path: ['showcase', slug],
|
|
|
|
},
|
2023-06-19 16:27:13 -05:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-04 13:28:46 -05:00
|
|
|
export const getStaticPaths = getSanityStaticPaths('showcase')
|
2023-06-19 16:27:13 -05:00
|
|
|
|
|
|
|
export default ShowcasePage
|