-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
50 lines (47 loc) · 1.63 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { useMemo } from 'react';
import { getMDXComponent } from 'mdx-bundler/client';
import components from '@/components/MDXComponents';
import Container from '@/components/Container';
import { StaticI18nLink } from '@/components/StaticI18nLink';
import { getStaticPaths, makeStaticProps } from '@/lib/getStatic'
import getSlug from '@/lib/getSlug'
import { useTranslation } from 'next-i18next'
export default function Test({ code, frontMatter }) {
const Component = useMemo(() => getMDXComponent(code), [code]);
const { t, i18n } = useTranslation('common')
return (
<Container
title={frontMatter.title || frontMatter.name}
description="bla bla"
>
<article className="flex flex-col justify-center items-start max-w-2xl mx-auto mb-16 w-full">
<div className="prose dark:prose-dark w-full">
coming from i18next: {t('title')}
<hr />
coming from markdown:
<Component components={components} />
<hr />
<div style={{ display: 'grid' }}>
<StaticI18nLink
href='/'
locale={i18n.language === 'en' ? 'de' : 'en'}
>
<button>
{t('change-locale')}
</button>
</StaticI18nLink>
<StaticI18nLink href='/second-page'>
<button
type='button'
>
{t('to-second-page')}
</button>
</StaticI18nLink>
</div>
</div>
</article>
</Container>
);
}
const getStaticProps = makeStaticProps(getSlug(import.meta.url));
export { getStaticPaths, getStaticProps };