diff --git a/.eslintrc.json b/.eslintrc.json index bd3d146..85913e7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,52 +1,9 @@ { - "root": true, - "env": { - "node": true, - "es6": true - }, - "parserOptions": { - "ecmaVersion": 8 - }, - "plugins": ["prettier"], - "ignorePatterns": ["node_modules/*", ".next/*", ".out/*", "!.prettierrc.js"], - "extends": ["eslint:recommended"], - "overrides": [ - { - "files": ["**/*.ts", "**/*.tsx"], - "parser": "@typescript-eslint/parser", - "settings": { - "react": { - "version": "detect" - } - }, - "env": { - "browser": true, - "node": true, - "es6": true - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:react/recommended", - "plugin:react-hooks/recommended", - "plugin:jsx-a11y/recommended" - ], - "rules": { - "prettier/prettier": "error", - "react/prop-types": "off", - "react/react-in-jsx-scope": "off", - "jsx-a11y/anchor-is-valid": "off", - "jsx-a11y/no-autofocus": "off", - "@typescript-eslint/no-unused-vars": ["error"], - "@typescript-eslint/explicit-function-return-type": [ - "warn", - { - "allowExpressions": true, - "allowConciseArrowFunctionExpressionsStartingWithVoid": true, - "allowTypedFunctionExpressions": true - } - ] - } - } - ] -} + "plugins": [ + "prettier" + ], + "extends": "next/core-web-vitals", + "rules": { + "prettier/prettier": "error" + } +} \ No newline at end of file diff --git a/next-env.d.ts b/next-env.d.ts index 7b7aa2c..9bc3dd4 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,2 +1,6 @@ /// /// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/next-i18next.config.js b/next-i18next.config.js new file mode 100644 index 0000000..106a010 --- /dev/null +++ b/next-i18next.config.js @@ -0,0 +1,6 @@ +module.exports = { + i18n: { + locales: ['en', 'nl'], + defaultLocale: 'en', + }, +}; diff --git a/next.config.js b/next.config.js index 315f3ca..b12122e 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,5 @@ +const { i18n } = require('./next-i18next.config'); + module.exports = { - i18n: { - locales: ['en', 'nl'], - defaultLocale: 'en', - }, -} \ No newline at end of file + i18n, +}; diff --git a/package.json b/package.json index d573483..5895021 100644 --- a/package.json +++ b/package.json @@ -7,34 +7,25 @@ "build": "next build", "start": "next start", "prettify": "prettier --write .", - "lint": "eslint src" + "lint": "next lint" }, "dependencies": { - "luxon": "^2.0.1", "milligram": "^1.4.1", - "next": "^10.2.3", - "next-localization": "^0.11.0", - "next-themes": "^0.0.14", + "next": "^11.1.2", + "next-i18next": "^8.8.0", + "next-themes": "^0.0.15", "react": "^17.0.2", "react-dom": "^17.0.2", - "react-google-recaptcha": "^2.1.0", "react-icons": "^4.2.0", - "sass": "^1.34.0", - "swr": "^0.5.6" + "sass": "^1.42.1" }, "devDependencies": { - "@types/luxon": "^1.27.1", "@types/node": "^15.6.1", "@types/react": "^17.0.6", - "@types/react-google-recaptcha": "^2.1.0", - "@typescript-eslint/eslint-plugin": "^4.25.0", - "@typescript-eslint/parser": "^4.25.0", "eslint": "^7.27.0", - "eslint-plugin-jsx-a11y": "^6.4.1", + "eslint-config-next": "11.1.2", "eslint-plugin-prettier": "^3.4.0", - "eslint-plugin-react": "^7.24.0", - "eslint-plugin-react-hooks": "^4.2.0", "prettier": "^2.3.0", - "typescript": "^4.2.4" + "typescript": "^4.4.3" } } diff --git a/public/locales/en/404.json b/public/locales/en/404.json new file mode 100644 index 0000000..d9bb435 --- /dev/null +++ b/public/locales/en/404.json @@ -0,0 +1,5 @@ +{ + "title": "Page not found", + "description": "This page either doesn't exist or has been deleted", + "back": "Go back" +} diff --git a/public/locales/en/common.json b/public/locales/en/common.json new file mode 100644 index 0000000..e69de29 diff --git a/public/locales/en/home.json b/public/locales/en/home.json new file mode 100644 index 0000000..89b9eb8 --- /dev/null +++ b/public/locales/en/home.json @@ -0,0 +1,9 @@ +{ + "title": "Home", + "description": "A simple portfolio website to display my projects.", + "subtitle": "Hi, I am a full stack web developer", + "projects": { + "title": "Projects", + "button": "Check out my projects" + } +} diff --git a/public/locales/en/nav.json b/public/locales/en/nav.json new file mode 100644 index 0000000..4aedf2f --- /dev/null +++ b/public/locales/en/nav.json @@ -0,0 +1,6 @@ +{ + "title": "Portfolio", + "projects": "Projects", + "contact": "Contact", + "github": "Source code" +} diff --git a/public/locales/nl/404.json b/public/locales/nl/404.json new file mode 100644 index 0000000..0dbf524 --- /dev/null +++ b/public/locales/nl/404.json @@ -0,0 +1,5 @@ +{ + "title": "Pagina niet gevonden", + "description": "Deze pagina bestaat niet of is verwijderd", + "back": "Ga terug" +} diff --git a/public/locales/nl/common.json b/public/locales/nl/common.json new file mode 100644 index 0000000..e69de29 diff --git a/public/locales/nl/home.json b/public/locales/nl/home.json new file mode 100644 index 0000000..fb89cdc --- /dev/null +++ b/public/locales/nl/home.json @@ -0,0 +1,9 @@ +{ + "title": "Thuis", + "description": "Een simpele portfolio website om mijn projecten te bekijken.", + "subtitle": "Hoi, Ik ben een full stack web developer", + "projects": { + "title": "Projecten", + "button": "Bekijk mijn projecten" + } +} diff --git a/public/locales/nl/nav.json b/public/locales/nl/nav.json new file mode 100644 index 0000000..93978f7 --- /dev/null +++ b/public/locales/nl/nav.json @@ -0,0 +1,6 @@ +{ + "title": "Portfolio", + "projects": "Projecten", + "contact": "Contact", + "github": "Bron code" +} diff --git a/public/robots.txt b/public/robots.txt index c2459b4..6f27bb6 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,2 +1,2 @@ User-agent: * -Disallow: /shifts \ No newline at end of file +Disallow: \ No newline at end of file diff --git a/src/components/Navbar.module.scss b/src/components/Navbar.module.scss index 0eb3ca2..ff376b1 100644 --- a/src/components/Navbar.module.scss +++ b/src/components/Navbar.module.scss @@ -29,6 +29,8 @@ .select { width: 7.5rem; margin-bottom: 0; + + background-color: $bg-primary; } .items { diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index c4b8b16..b3cb874 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -1,30 +1,28 @@ -import { useI18n } from 'next-localization'; import { useRouter } from 'next/router'; import { useTheme } from 'next-themes'; import Link from 'next/link'; +import React, { ChangeEvent, FC } from 'react'; + import { BiMoon } from 'react-icons/bi'; import { ImSun } from 'react-icons/im'; -import { FC } from 'react'; - import styles from './Navbar.module.scss'; +import { useTranslation } from 'next-i18next'; const LanguageSelector: FC = () => { const router = useRouter(); - const path = router.pathname; + const locale = router.locale; + + const updateLocale = (e: ChangeEvent) => { + router.push('', '', { locale: e.target.value }); + }; return ( - {router.locales.map((locale) => ( - ))} @@ -33,7 +31,7 @@ const LanguageSelector: FC = () => { }; const Navbar: FC = () => { - const { t } = useI18n(); + const { t } = useTranslation('nav'); const { theme, setTheme } = useTheme(); const switchTheme = (): void => setTheme(theme == 'dark' ? 'light' : 'dark'); @@ -42,16 +40,16 @@ const Navbar: FC = () => {