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

58 lines
1.5 KiB
JavaScript
Raw Normal View History

2023-05-17 17:04:15 +02:00
// Dependencies
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
2023-05-26 11:38:27 +02:00
// Hooks
import { useTranslation } from 'next-i18next'
2023-05-17 17:04:15 +02:00
// Components
2023-05-26 11:38:27 +02:00
import Head from 'next/head'
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
2023-05-17 17:04:15 +02:00
import { Popout } from 'shared/components/popout.mjs'
2023-05-26 11:38:27 +02:00
import { WebLink } from 'shared/components/web-link.mjs'
2023-05-17 17:04:15 +02:00
2023-05-26 11:38:27 +02:00
const ns = ['lab', ...pageNs]
2023-05-17 17:04:15 +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-05-26 11:38:27 +02:00
const HomePage = ({ page }) => {
const { t } = useTranslation(ns)
return (
<PageWrapper {...page} t={t('lab:welcome')}>
<Head>
<title>{t('lab:welcome')}</title>
</Head>
<div>
<h1>{t('lab:welcome')}</h1>
<div className="max-w-prose">
<p>{t('lab:about')}</p>
<Popout link compact>
<WebLink href="https://freesewing.org/" txt={t('lab:goToOrg')} />
</Popout>
<Popout note>
<h5>{t('lab:what')}</h5>
<p>{t('lab:what1')}</p>
<p>{t('lab:what2')}</p>
<p>{t('lab:what3')}</p>
</Popout>
</div>
2023-05-17 17:04:15 +02:00
</div>
2023-05-26 11:38:27 +02:00
</PageWrapper>
)
}
2023-05-17 17:04:15 +02:00
export default HomePage
export async function getStaticProps({ locale }) {
return {
props: {
2023-05-26 11:38:27 +02:00
...(await serverSideTranslations(locale, ns)),
2023-05-17 17:04:15 +02:00
page: {
locale,
path: [],
},
},
}
}