2022-01-22 17:55:03 +01:00
|
|
|
import Page from 'shared/components/wrappers/page.js'
|
|
|
|
import useApp from 'site/hooks/useApp.js'
|
|
|
|
import Head from 'next/head'
|
|
|
|
import Link from 'next/link'
|
|
|
|
import About from 'site/components/about.js'
|
2022-02-06 19:16:49 +01:00
|
|
|
import { useTranslation } from 'next-i18next'
|
2022-01-22 17:55:03 +01:00
|
|
|
|
|
|
|
const links = (section, list) => list.map(design => (
|
|
|
|
<li key={design} className="">
|
|
|
|
<Link href={`/${section}/${design}`}>
|
|
|
|
<a className="text-secondary text-xl capitalize">{design}</a>
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
))
|
|
|
|
|
2022-01-25 09:03:06 +01:00
|
|
|
const PatternListPageTemplate = ({ sections=false }) => {
|
2022-01-22 17:55:03 +01:00
|
|
|
const app = useApp()
|
2022-02-06 19:16:49 +01:00
|
|
|
const { t } = useTranslation(['app'])
|
2022-01-25 09:03:06 +01:00
|
|
|
if (sections === false) sections = Object.keys(app.patterns)
|
|
|
|
|
2022-01-22 17:55:03 +01:00
|
|
|
return (
|
|
|
|
<Page app={app} title="FreeSewing Lab" noSearch>
|
|
|
|
<Head>
|
|
|
|
<meta property="og:title" content="lab.FreeSewing.dev" key="title" />
|
|
|
|
<meta property="og:type" content="article" key='type' />
|
|
|
|
<meta property="og:description" content="The FreeSewing lab is an online test environment for all our patterns" key='description' />
|
|
|
|
<meta property="og:article:author" content='Joost De Cock' key='author' />
|
|
|
|
<meta property="og:image" content="https://canary.backend.freesewing.org/og-img/en/lab/" key='image' />
|
|
|
|
<meta property="og:image:type" content="image/png" />
|
|
|
|
<meta property="og:image:width" content="1200" />
|
|
|
|
<meta property="og:image:height" content="630" />
|
|
|
|
<meta property="og:url" content="https://lab.freesewing.dev/" key='url' />
|
|
|
|
<meta property="og:locale" content="en_US" key='locale' />
|
|
|
|
<meta property="og:site_name" content="lab.freesewing.dev" key='site' />
|
|
|
|
</Head>
|
|
|
|
<div className="max-w-screen-md">
|
2022-01-25 09:03:06 +01:00
|
|
|
{Object.keys(app.navigation).map(section => {
|
2022-01-22 17:55:03 +01:00
|
|
|
if (sections.indexOf(section) !== -1) return (
|
2022-01-24 12:34:29 +01:00
|
|
|
<div key={section}>
|
2022-02-07 20:02:28 +01:00
|
|
|
<h2>{t(app.navigation[section].__title)}</h2>
|
2022-01-22 17:55:03 +01:00
|
|
|
<ul className="flex flex-row flex-wrap gap-2">
|
2022-01-25 09:03:06 +01:00
|
|
|
{links(section, app.patterns[section])}
|
2022-01-22 17:55:03 +01:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
else return null
|
|
|
|
})}
|
|
|
|
<About />
|
|
|
|
</div>
|
|
|
|
</Page>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-01-24 12:34:29 +01:00
|
|
|
export default PatternListPageTemplate
|