Made app next export compatible

dependabot/npm_and_yarn/typescript-eslint/parser-4.33.0
guusvanmeerveld 3 years ago
parent 68e9bca751
commit a9047e0e8a

@ -1,9 +1,7 @@
{ {
"plugins": [ "plugins": ["prettier"],
"prettier" "extends": "next/core-web-vitals",
], "rules": {
"extends": "next/core-web-vitals", "prettier/prettier": "error"
"rules": { }
"prettier/prettier": "error" }
}
}

@ -22,7 +22,7 @@ jobs:
- name: ESlint check - name: ESlint check
run: yarn lint run: yarn lint
docker: docker:
needs: test needs: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -35,7 +35,7 @@ jobs:
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
@ -58,4 +58,3 @@ jobs:
- name: Image digest - name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }} run: echo ${{ steps.docker_build.outputs.digest }}

@ -8,4 +8,5 @@ LICENSE
.env .env
.prettierrc .prettierrc
.next .next
next-env.d.ts next-env.d.ts
out

@ -1,7 +1,7 @@
version: '3' version: '3'
services: services:
app: app:
container_name: portfolio container_name: portfolio
build: . build: .
env_file: .env env_file: .env

@ -1,16 +1,18 @@
// @ts-check // @ts-check
const { i18n } = require('./next-i18next.config');
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
module.exports = { module.exports = {
i18n,
images: { images: {
domains: [process.env.CDN_ENDPOINT], loader: 'imgix',
path: process.env.IMGIX_PATH ?? 'https://guusvanmeerveld.imgix.net',
}, },
env: { env: {
CDN_ENDPOINT: process.env.CDN_ENDPOINT, CDN_ENDPOINT: process.env.CDN_ENDPOINT,
}, },
webpack: (config) => {
config.module.rules.push({ test: /\.svg$/, use: ['@svgr/webpack'] });
return config;
},
}; };

@ -5,6 +5,7 @@
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",
"export": "next build && next export",
"start": "next start", "start": "next start",
"prettify": "prettier --write .", "prettify": "prettier --write .",
"lint": "next lint" "lint": "next lint"
@ -20,9 +21,11 @@
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-icons": "^4.2.0", "react-icons": "^4.2.0",
"sass": "^1.42.1", "sass": "^1.42.1",
"sharp": "^0.29.1" "sharp": "^0.29.1",
"swr": "^1.0.1"
}, },
"devDependencies": { "devDependencies": {
"@svgr/webpack": "^5.5.0",
"@types/node": "^15.6.1", "@types/node": "^15.6.1",
"@types/react": "^17.0.6", "@types/react": "^17.0.6",
"eslint": "^7.27.0", "eslint": "^7.27.0",

@ -1,5 +0,0 @@
{
"title": "Page not found",
"description": "This page either doesn't exist or has been deleted",
"back": "Go back"
}

@ -1,9 +0,0 @@
{
"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"
}
}

@ -1,6 +0,0 @@
{
"title": "Portfolio",
"projects": "Projects",
"contact": "Contact",
"github": "Source code"
}

@ -1,5 +0,0 @@
{
"title": "Pagina niet gevonden",
"description": "Deze pagina bestaat niet of is verwijderd",
"back": "Ga terug"
}

@ -1,9 +0,0 @@
{
"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"
}
}

@ -1,6 +0,0 @@
{
"title": "Portfolio",
"projects": "Projecten",
"contact": "Contact",
"github": "Bron code"
}

@ -3,7 +3,7 @@
"name": "Guus van Meerveld's portfolio", "name": "Guus van Meerveld's portfolio",
"icons": [ "icons": [
{ {
"src": "/assets/images/profile-192.png", "src": "/favicon.ico",
"type": "image/png", "type": "image/png",
"sizes": "192x192" "sizes": "192x192"
} }
@ -13,4 +13,4 @@
"scope": "/", "scope": "/",
"theme_color": "#388e3c", "theme_color": "#388e3c",
"description": "A simple portfolio website to display my projects." "description": "A simple portfolio website to display my projects."
} }

@ -1,26 +1,21 @@
import Image from 'next/image';
import Link from 'next/link'; import Link from 'next/link';
import { FaTwitter, FaYoutube, FaCoffee, FaGithub } from 'react-icons/fa'; import { FaTwitter, FaYoutube, FaCoffee, FaGithub } from 'react-icons/fa';
import { FC } from 'react'; import { FC } from 'react';
import { ProfileImage } from '@svg/index';
import styles from './Footer.module.scss'; import styles from './Footer.module.scss';
const Footer: FC = () => { const Footer: FC = () => {
return ( return (
<footer className={styles.body}> <footer className={styles.body}>
<div className="container"> <div className="container">
<Image <ProfileImage className={styles.profile + ' profile'} width={50} height={50} />
src="/assets/images/profile.svg"
width={50}
height={50}
alt=""
className={styles.profile + ' profile'}
/>
<div className={styles.branding}> <div className={styles.branding}>
Guus van Meerveld <br /> Guus van Meerveld <br />
&#169; 2021 &#169; 2017 - {new Date().getFullYear()}
</div> </div>
<div className={styles.socials}> <div className={styles.socials}>
<Link passHref href="https://twitter.com/GuusvanMeerveld" aria-label="twitter link"> <Link passHref href="https://twitter.com/GuusvanMeerveld" aria-label="twitter link">

@ -21,9 +21,8 @@
.header { .header {
flex: 1; flex: 1;
// height: max-content; display: flex;
align-items: center;
font-size: 2rem;
} }
.select { .select {

@ -1,38 +1,18 @@
import { useRouter } from 'next/router';
import { useTheme } from 'next-themes'; import { useTheme } from 'next-themes';
import Link from 'next/link'; import Link from 'next/link';
import React, { ChangeEvent, FC } from 'react'; import { useTranslation } from 'next-i18next';
import React, { FC } from 'react';
import { BiMoon } from 'react-icons/bi'; import { BiMoon } from 'react-icons/bi';
import { ImSun } from 'react-icons/im'; import { ImSun } from 'react-icons/im';
import styles from './Navbar.module.scss'; import styles from './Navbar.module.scss';
import { useTranslation } from 'next-i18next';
const LanguageSelector: FC = () => {
const router = useRouter();
const locale = router.locale; import { ProfileImage } from '@svg/index';
const updateLocale = (e: ChangeEvent<HTMLSelectElement>) => {
router.push('', '', { locale: e.target.value });
};
return (
<select className={styles.select} onChange={updateLocale} defaultValue={locale}>
{router.locales.map((locale) => (
<option key={locale} value={locale}>
{locale.toUpperCase()}
</option>
))}
</select>
);
};
const Navbar: FC = () => { const Navbar: FC = () => {
const { t } = useTranslation('nav');
const { theme, setTheme } = useTheme(); const { theme, setTheme } = useTheme();
const switchTheme = (): void => setTheme(theme == 'dark' ? 'light' : 'dark'); const switchTheme = (): void => setTheme(theme == 'dark' ? 'light' : 'dark');
@ -40,22 +20,26 @@ const Navbar: FC = () => {
<nav className={styles.bar}> <nav className={styles.bar}>
<div className="container"> <div className="container">
<div className={styles.content}> <div className={styles.content}>
<div className={styles.header}>{t('title')}</div> <div className={styles.header}>
<Link href="/">
<a>
<ProfileImage className="profile" width={32} height={32} />
</a>
</Link>
</div>
<div className={styles.items}> <div className={styles.items}>
<Link href="/#projects"> <Link href="/#projects">
<a>{t('projects')}</a> <a>Projects</a>
</Link>
<Link href="/blog">
<a>Contact</a>
</Link> </Link>
{/* <Link href="/contact">
<a>{t('contact')}</a>
</Link> */}
<Link href="https://github.com/guusvanmeerveld/portfolio"> <Link href="https://github.com/guusvanmeerveld/portfolio">
<a>{t('github')}</a> <a>Github</a>
</Link> </Link>
<BiMoon onClick={switchTheme} className={styles.moon} /> <BiMoon onClick={switchTheme} className={styles.moon} />
<ImSun onClick={switchTheme} className={styles.sun} /> <ImSun onClick={switchTheme} className={styles.sun} />
<LanguageSelector />
</div> </div>
</div> </div>
</div> </div>

@ -16,7 +16,7 @@ const Page: FC<{
<meta name="description" content={description} /> <meta name="description" content={description} />
<meta name="keywords" content="guus van meerveld argo magister tempo discord" /> <meta name="keywords" content="guus van meerveld argo magister tempo discord" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" sizes="192x192" href="/assets/images/profile-192.png" /> <link rel="apple-touch-icon" sizes="192x192" href="/favicon.ico" />
</Head> </Head>
{children} {children}
</> </>

@ -27,12 +27,7 @@ const Project: FC<ProjectComponent> = ({ name, description, buttons, cover, righ
</div> </div>
{cover ? ( {cover ? (
<div className={styles.cover}> <div className={styles.cover}>
<Image <Image src={cover} width={200} height={200} alt={name} />
src={`https://${process.env.CDN_ENDPOINT}/portfolio/${cover}`}
width={200}
height={200}
alt={name}
/>
</div> </div>
) : null} ) : null}
</div> </div>

@ -0,0 +1,5 @@
declare module '*svg' {
import React from 'react';
const SVG: React.VFC<React.SVGProps<SVGSVGElement>>;
export default SVG;
}

@ -7,23 +7,16 @@ import Layout from '@components/Layout';
import PageBuilder from '@components/PageBuilder'; import PageBuilder from '@components/PageBuilder';
const NotFound: NextPage = () => { const NotFound: NextPage = () => {
const { t } = useTranslation('404'); const title = 'Page not found';
const description = "This page either doesn't exist or has been deleted";
return ( return (
<Page title={t('title')} description={t('description')}> <Page title={title} description={description}>
<Layout> <Layout>
<PageBuilder button={t('back')} header={t('title')} subtitle={t('description')} /> <PageBuilder button="Go back" header={title} subtitle={description} />
</Layout> </Layout>
</Page> </Page>
); );
}; };
export const getStaticProps: GetStaticProps = async ({ locale }) => {
return {
props: {
...(await serverSideTranslations(locale, ['404', 'nav'])),
},
};
};
export default NotFound; export default NotFound;

@ -3,36 +3,35 @@ import { GetStaticProps, NextPage } from 'next';
import axios, { AxiosError } from 'axios'; import axios, { AxiosError } from 'axios';
import chalk from 'chalk'; import chalk from 'chalk';
import Image from 'next/image';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import ProjectModel from '@models/project';
import Layout from '@components/Layout'; import Layout from '@components/Layout';
import Page from '@components/Page'; import Page from '@components/Page';
import Project from '@components/Project'; import Project from '@components/Project';
import ProjectModel from '@models/project';
import { ProfileImage } from '@svg/index';
import styles from './Index.module.scss'; import styles from './Index.module.scss';
const Home: NextPage<{ projects: ProjectModel[] }> = ({ projects }) => { const Home: NextPage<{ projects: ProjectModel[] }> = ({ projects }) => {
const { t } = useTranslation('home');
return ( return (
<Page description={t('description')} title={t('title')}> <Page description="A simple portfolio website to display my projects." title="Home">
<Layout> <Layout>
<div className={styles.body}> <div className={styles.body}>
<div className={styles.content + ' container'}> <div className={styles.content + ' container'}>
<div className={styles.profile + ' profile'}> <div className={styles.profile}>
<Image src="/assets/images/profile.svg" width={100} height={100} alt="" /> <ProfileImage height={100} width={100} className="profile" />
</div> </div>
<h1>Guus van Meerveld</h1> <h1>Guus van Meerveld</h1>
<h4 className={styles.subtitle}>{t('subtitle')}</h4> <h4 className={styles.subtitle}>Full-stack developer</h4>
<a href="#projects" className="button"> <a href="#projects" className="button">
{t('projects.button')} Check out my projects
</a> </a>
</div> </div>
</div> </div>
@ -40,7 +39,7 @@ const Home: NextPage<{ projects: ProjectModel[] }> = ({ projects }) => {
<div className={styles.projects}> <div className={styles.projects}>
<div className="container"> <div className="container">
<h1 className={styles.projectsHeader} id="projects"> <h1 className={styles.projectsHeader} id="projects">
{t('projects.title')} Projects
</h1> </h1>
{projects.map((project, i) => { {projects.map((project, i) => {
@ -54,12 +53,9 @@ const Home: NextPage<{ projects: ProjectModel[] }> = ({ projects }) => {
); );
}; };
export const getStaticProps: GetStaticProps = async ({ locale }) => { export const getStaticProps: GetStaticProps = async () => {
const translation = await serverSideTranslations(locale, ['home', 'nav']); const projects: ProjectModel[] | undefined = await axios
.get(`https://${process.env.CDN_ENDPOINT}/portfolio/projects-en.json`)
const projects: ProjectModel[] | undefined = await axios(
`https://${process.env.CDN_ENDPOINT}/portfolio/projects-${locale}.json`
)
.then(({ data }) => { .then(({ data }) => {
console.log( console.log(
chalk`{magenta event} - retrieved projects from ` + chalk`{magenta event} - retrieved projects from ` +
@ -78,7 +74,6 @@ export const getStaticProps: GetStaticProps = async ({ locale }) => {
if (projects) { if (projects) {
return { return {
props: { props: {
...translation,
projects, projects,
}, },
}; };

@ -0,0 +1 @@
export { default as ProfileImage } from './profile.svg';

Before

Width:  |  Height:  |  Size: 629 B

After

Width:  |  Height:  |  Size: 629 B

@ -3,11 +3,10 @@
"baseUrl": "src", "baseUrl": "src",
"paths": { "paths": {
"@components/*": ["components/*"], "@components/*": ["components/*"],
"@svg/*": ["svg/*"],
"@styles/*": ["styles/*"], "@styles/*": ["styles/*"],
"@models/*": ["models/*"], "@models/*": ["models/*"],
"@config/*": ["config/*"], "@config/*": ["config/*"],
"@utils/*": ["utils/*"],
"@src/*": ["./*"] "@src/*": ["./*"]
}, },
"target": "es5", "target": "es5",

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save