1
0
Fork 0
freesewing/sites/lab/pages/designs/index.mjs

50 lines
1.4 KiB
JavaScript
Raw Normal View History

2023-09-16 09:37:41 +02:00
// Dependencies
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
2023-09-25 17:49:39 +02:00
import { nsMerge } from 'shared/utils.mjs'
2023-09-27 15:42:42 +02:00
// Hooks
import { useTranslation } from 'next-i18next'
2023-09-16 09:37:41 +02:00
// Components
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
import { DesignPicker, ns as designNs } from 'shared/components/designs/design-picker.mjs'
2023-09-25 17:49:39 +02:00
import { BareLayout } from 'site/components/layouts/bare.mjs'
2023-09-16 09:37:41 +02:00
// Translation namespaces used on this page
2023-09-27 15:42:42 +02:00
const ns = nsMerge(designNs, pageNs, 'account')
2023-09-16 09:37:41 +02:00
/*
* Each page MUST be wrapped in the PageWrapper component.
* You also MUST spread props.page into this wrapper component
* when path and locale come from static props (as here)
* or set them manually.
*/
2023-09-27 15:42:42 +02:00
const DesignsPage = ({ page }) => {
const { t } = useTranslation(ns)
return (
<PageWrapper {...page} layout={BareLayout}>
<div className="px-4 m-auto">
2023-09-27 15:42:42 +02:00
<h1 className="text-center">FreeSewing {t('account:designs')}</h1>
<DesignPicker
hrefBuilder={(design) => `/designs/${design}`}
linkTo="docs"
altLinkTo="new"
/>
2023-09-27 15:42:42 +02:00
</div>
</PageWrapper>
)
}
2023-09-16 09:37:41 +02:00
export default DesignsPage
export async function getStaticProps({ locale }) {
return {
props: {
2023-09-25 17:49:39 +02:00
...(await serverSideTranslations(locale, ns)),
2023-09-16 09:37:41 +02:00
page: {
locale,
path: ['designs'],
},
},
}
}