From 050e3829843a5314cc578c826d77374731978354 Mon Sep 17 00:00:00 2001 From: Guusvanmeerveld Date: Tue, 20 Jul 2021 11:49:54 +0200 Subject: [PATCH] Switched to server side Next.js --- Dockerfile | 33 +++++++++++++++++++++++ next.config.js | 6 +++++ package.json | 5 ++-- public/appie.json | 29 --------------------- public/robots.txt | 2 +- src/components/Footer.module.scss | 8 +++--- src/components/Footer.tsx | 42 +++++++++++++++++++----------- src/components/Navbar.tsx | 14 +++++++--- src/components/Project.module.scss | 10 +++---- src/components/Project.tsx | 11 +++++--- src/config/projects.json | 2 +- src/pages/404.tsx | 12 +++++---- src/pages/Home.module.scss | 2 -- src/pages/index.tsx | 9 +++---- src/pages/shifts.tsx | 10 ++++--- src/pages/thanks.tsx | 12 +++++---- 16 files changed, 119 insertions(+), 88 deletions(-) create mode 100644 Dockerfile create mode 100644 next.config.js delete mode 100644 public/appie.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b36bbe5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ + +FROM node:slim AS deps + +WORKDIR /app +COPY package.json yarn.lock ./ +RUN yarn install --frozen-lockfile + +FROM node:slim AS builder +WORKDIR /app +COPY . . +COPY --from=deps /app/node_modules ./node_modules +ENV NEXT_TELEMETRY_DISABLED 1; +RUN yarn build && yarn install --production --ignore-scripts --prefer-offline + +FROM node:slim AS runner +WORKDIR /app + +ENV NODE_ENV production + +RUN addgroup -g 1001 -S nodejs +RUN adduser -S nextjs -u 1001 + +COPY --from=builder /app/next.config.js ./ +COPY --from=builder /app/public ./public +COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package.json ./package.json + +USER nextjs + +EXPOSE 3000 + +CMD ["yarn", "start"] \ No newline at end of file diff --git a/next.config.js b/next.config.js new file mode 100644 index 0000000..ddb581a --- /dev/null +++ b/next.config.js @@ -0,0 +1,6 @@ +module.exports = { + i18n: { + locales: ['en-US', 'nl-NL'], + defaultLocale: 'en-US', + }, +} \ No newline at end of file diff --git a/package.json b/package.json index 3e656e6..d1bdd7a 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,7 @@ "build": "next build", "start": "next start", "prettify": "prettier --write .", - "lint": "eslint src", - "export": "next build && next export" + "lint": "eslint src" }, "dependencies": { "@types/luxon": "^1.27.1", @@ -37,4 +36,4 @@ "prettier": "^2.3.0", "typescript": "^4.2.4" } -} +} \ No newline at end of file diff --git a/public/appie.json b/public/appie.json deleted file mode 100644 index b97e1b1..0000000 --- a/public/appie.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "updated": "2021-07-15T22:29:19.164Z", - "parsed": [ - { - "start": "2021-07-07T17:00:00.000Z", - "end": "2021-07-07T19:00:00.000Z" - }, - { - "start": "2021-07-08T17:00:00.000Z", - "end": "2021-07-08T20:00:00.000Z" - }, - { - "start": "2021-07-10T17:00:00.000Z", - "end": "2021-07-10T20:30:00.000Z" - }, - { - "start": "2021-07-14T17:30:00.000Z", - "end": "2021-07-14T19:30:00.000Z" - }, - { - "start": "2021-07-17T17:00:00.000Z", - "end": "2021-07-17T20:30:00.000Z" - }, - { - "start": "2021-07-18T10:00:00.000Z", - "end": "2021-07-18T13:30:00.000Z" - } - ] -} \ No newline at end of file diff --git a/public/robots.txt b/public/robots.txt index 5e4ff3e..c2459b4 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,2 +1,2 @@ User-agent: * -Disallow: \ No newline at end of file +Disallow: /shifts \ No newline at end of file diff --git a/src/components/Footer.module.scss b/src/components/Footer.module.scss index 1333136..60c464d 100644 --- a/src/components/Footer.module.scss +++ b/src/components/Footer.module.scss @@ -5,11 +5,6 @@ padding: 3rem; } -.profile { - width: 5rem; - height: 5rem; -} - .branding { display: inline-block; font-size: 2rem; @@ -25,6 +20,9 @@ } .socialLink { + // color: var(--primary); + // cursor: pointer; + height: 3rem; width: 3rem; margin-right: 2rem; diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 2835fb0..68495a2 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,3 +1,6 @@ +import Image from 'next/image'; +import Link from 'next/link'; + import { FaTwitter, FaYoutube, FaCoffee, FaGithub } from 'react-icons/fa'; import { FC } from 'react'; @@ -8,10 +11,10 @@ const Footer: FC = () => { return ( diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 92bc89e..d4a46f0 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -1,4 +1,6 @@ import { useTheme } from 'next-themes'; +import Link from 'next/link'; + import { BiMoon } from 'react-icons/bi'; import { ImSun } from 'react-icons/im'; @@ -15,9 +17,15 @@ const Navbar: FC = () => {
Portfolio
- Projects - Contact - Source code + + Projects + + + Contact + + + Source code + diff --git a/src/components/Project.module.scss b/src/components/Project.module.scss index edc8791..7e216fb 100644 --- a/src/components/Project.module.scss +++ b/src/components/Project.module.scss @@ -28,13 +28,9 @@ .cover { width: 50%; - - img { - display: block; - margin: auto; - height: 20rem; - width: 20rem; - } + display: flex; + justify-content: center; + align-items: center; } @media only screen and (max-width: 600px) { diff --git a/src/components/Project.tsx b/src/components/Project.tsx index ca05748..2c01937 100644 --- a/src/components/Project.tsx +++ b/src/components/Project.tsx @@ -1,3 +1,6 @@ +import Image from 'next/image'; +import Link from 'next/link'; + import { FC } from 'react'; import ProjectType from '@models/project'; @@ -18,14 +21,14 @@ const Project: FC = ({ name, description, buttons, cover, righ

{buttons.map((button, i) => ( - - {button.text} - + + {button.text} + ))}
{cover ? (
- +
) : null}
diff --git a/src/config/projects.json b/src/config/projects.json index 8421ca7..04e0c74 100644 --- a/src/config/projects.json +++ b/src/config/projects.json @@ -31,7 +31,7 @@ }, { "name": "Keyzo", - "description": "Keyzo is an electron-based program written in JavaScript and CSS but I amplanning on moving to TypeScript. It's main use is to bring every keybind you will every need into a single program, with a simple and neat interface.", + "description": "Keyzo is an electron-based program written in JavaScript and CSS but I am planning on moving to TypeScript. It's main use is to bring every keybind you will every need into a single program, with a simple and neat interface.", "buttons": [ { "link": "https://keyzo.net", diff --git a/src/pages/404.tsx b/src/pages/404.tsx index c605f49..dd70e98 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -1,8 +1,10 @@ -import Page from 'src/components/Page'; -import Layout from 'src/components/Layout'; +import Link from 'next/link'; import { FC } from 'react'; +import Page from '@components/Page'; +import Layout from '@components/Layout'; + const NotFound: FC = () => ( @@ -10,9 +12,9 @@ const NotFound: FC = () => (
Not found
This page either doesn't exist or has been deleted
- - Go back - + + Go back +
diff --git a/src/pages/Home.module.scss b/src/pages/Home.module.scss index ed218f5..ee9c6f3 100644 --- a/src/pages/Home.module.scss +++ b/src/pages/Home.module.scss @@ -10,8 +10,6 @@ } .profile { - height: 10rem; - width: 10rem; margin: auto; margin-bottom: 3rem; display: block; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index d5da855..21ad376 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,5 +1,7 @@ import { NextPage } from 'next'; +import Image from 'next/image'; + import Layout from '@components/Layout'; import Page from '@components/Page'; @@ -14,14 +16,11 @@ const Home: NextPage = () => (
- + Guus van Meerveld - - TypeScript / Dart developer,
- currently working on Argo. -
+ Hi, I am a full stack web developer Check out my projects diff --git a/src/pages/shifts.tsx b/src/pages/shifts.tsx index 5f8ebef..1fbe39f 100644 --- a/src/pages/shifts.tsx +++ b/src/pages/shifts.tsx @@ -1,4 +1,6 @@ import { NextPage } from 'next'; +import Link from 'next/link'; + import { Info, DateTime } from 'luxon'; import useSWR from 'swr'; @@ -24,9 +26,11 @@ const Error: FC = () => (

Error retrieving shift information

-
- - + + + + +
); diff --git a/src/pages/thanks.tsx b/src/pages/thanks.tsx index 723e374..be07537 100644 --- a/src/pages/thanks.tsx +++ b/src/pages/thanks.tsx @@ -1,6 +1,8 @@ -import Page from 'src/components/Page'; -import Layout from 'src/components/Layout'; import { NextPage } from 'next'; +import Link from 'next/link'; + +import Page from '@components/Page'; +import Layout from '@components/Layout'; const Thanks: NextPage = () => ( @@ -14,9 +16,9 @@ const Thanks: NextPage = () => (
Thank you!
Your submission is greatly appreciated!
- - Go back - + + Go back +