|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
import { useI18n } from 'next-localization';
|
|
|
|
|
import { useRouter } from 'next/router';
|
|
|
|
|
import { useTheme } from 'next-themes';
|
|
|
|
|
import { GetStaticProps } from 'next';
|
|
|
|
|
import Link from 'next/link';
|
|
|
|
|
|
|
|
|
|
import { BiMoon } from 'react-icons/bi';
|
|
|
|
@ -10,6 +10,28 @@ import { FC } from 'react';
|
|
|
|
|
|
|
|
|
|
import styles from './Navbar.module.scss';
|
|
|
|
|
|
|
|
|
|
const LanguageSelector: FC = () => {
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
const path = router.pathname;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<select className={styles.select} defaultValue={router.locale}>
|
|
|
|
|
{router.locales.map((locale) => (
|
|
|
|
|
<option
|
|
|
|
|
key={locale}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
router.push(path, path, { locale });
|
|
|
|
|
}}
|
|
|
|
|
value={locale}
|
|
|
|
|
>
|
|
|
|
|
{locale.toUpperCase()}
|
|
|
|
|
</option>
|
|
|
|
|
))}
|
|
|
|
|
</select>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const Navbar: FC = () => {
|
|
|
|
|
const { t } = useI18n();
|
|
|
|
|
|
|
|
|
@ -35,10 +57,7 @@ const Navbar: FC = () => {
|
|
|
|
|
<BiMoon onClick={switchTheme} className={styles.moon} />
|
|
|
|
|
<ImSun onClick={switchTheme} className={styles.sun} />
|
|
|
|
|
|
|
|
|
|
<select className={styles.select}>
|
|
|
|
|
<option value="nl">NL</option>
|
|
|
|
|
<option value="en">EN</option>
|
|
|
|
|
</select>
|
|
|
|
|
<LanguageSelector />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -46,12 +65,4 @@ const Navbar: FC = () => {
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const getStaticProps: GetStaticProps = async ({ locale }) => {
|
|
|
|
|
const { default: lngDict = {} } = await import(`../locales/${locale}.json`);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
props: { lngDict },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default Navbar;
|
|
|
|
|