2 min read
Rebuilding my portfolio on Next.js 16
Moving from Next 11, three styling systems and a contact form that could not work on GitHub Pages, to a static, accessible site with one design system.
- Next.js
- Tailwind CSS
- Accessibility
I put the first version of this portfolio online in early 2023, starting from a Next.js 11 template. It did its job, but by 2026 it was holding me back. This post covers what was wrong, what I changed, and the decisions behind it.
What I started with
The old site used three styling systems at once: Chakra UI v1, styled-components and CSS Modules, with FontAwesome, react-icons and AOS for scroll animations on top. Each library was reasonable on its own. Together they meant three ways to express a colour, two theme objects that had to stay in sync, and a lot of JavaScript shipped for a mostly static page.
The bigger problem was the contact form. It posted to a Next.js API route, but the site is deployed to GitHub Pages, which only serves static files. There is no server to run that route, so the request could never reach it. Worse, the form showed a success toast before sending the request, so visitors saw "You reached us!" either way.
Principles for the rebuild
- Static first. GitHub Pages is free and fast. Every page is pre-rendered at build time with
output: "export". - One design system. Tailwind CSS v4 with a small set of CSS custom properties: one neutral scale, one accent colour, and a fixed radius scale.
- Motion that earns its place. Animations run on
transformandopacity, respectprefers-reduced-motion, and never hide content that has not been animated in yet. - Accessible by default. Semantic landmarks, a skip link, visible focus rings, labelled inputs with inline errors, and colour pairs checked against WCAG AA.
Design tokens instead of theme objects
The old site passed a currentTheme object through every component as a prop. Now the theme is just CSS variables that change under a .dark class:
:root {
--bg: #fafafa;
--fg: #0c0c0e;
--accent: #c2410c;
}
.dark {
--bg: #09090b;
--fg: #f4f4f5;
--accent: #ff7a2f;
}
@theme inline {
--color-bg: var(--bg);
--color-fg: var(--fg);
--color-accent: var(--accent);
}
Components use bg-bg text-fg and never need to know which theme is active. The toggle offers System, Light and Dark, and defaults to the operating system setting.
A contact form that works on a static host
The form now posts to a hosted form service configured through NEXT_PUBLIC_CONTACT_ENDPOINT. If no endpoint is configured, it opens the visitor's email client with the message pre-filled, so it never fails silently. Validation runs inline with messages tied to each field through aria-describedby, and the success state only appears after the request succeeds.
Interactions without re-renders
The card spotlight effect follows the cursor by writing CSS custom properties directly on the element:
function onPointerMove(e: PointerEvent<HTMLDivElement>) {
const r = e.currentTarget.getBoundingClientRect();
e.currentTarget.style.setProperty("--mx", `${e.clientX - r.left}px`);
e.currentTarget.style.setProperty("--my", `${e.clientY - r.top}px`);
}
No React state is involved, so moving the mouse never triggers a render. The hero light works the same way: it writes two custom properties registered with @property, so a plain CSS transition can ease them. Scroll reveals use CSS scroll-driven animations (animation-timeline: view()), which need no JavaScript at all. The result is that the site ships no animation library.
What's next
Case studies for the projects on the work page, with real screenshots, and more posts here about things I build at work and on the side.