Writer portfolio
An editorial essayist portfolio with topic filters, CSS book covers and a passage whose words light up as it scrolls by.
"use client";
import { useEffect, useRef, useState, type CSSProperties } from "react";
import "./writer-portfolio.css";
/**
* WriterPortfolio: an editorial portfolio for an essayist ("Maren Holt").
* Its signature: a passage whose words light up one by one as it scrolls through
* the screen (CSS scroll-driven animation; browsers without it show the text in full).
*/
type Topic = "Cities" | "Work" | "Food";
const ESSAYS: {
title: string;
pub: string;
year: string;
minutes: number;
topic: Topic;
}[] = [
{
title: "The last night bus in Rotterdam",
pub: "The Atlantic",
year: "2026",
minutes: 14,
topic: "Cities",
},
{
title: "What a bakery knows about 4am",
pub: "The New Yorker",
year: "2026",
minutes: 22,
topic: "Food",
},
{
title: "Notes from a year of four-day weeks",
pub: "Wired",
year: "2025",
minutes: 11,
topic: "Work",
},
{
title: "Why every city wants a harbour again",
pub: "Guardian Long Read",
year: "2025",
minutes: 18,
topic: "Cities",
},
{
title: "My grandmother's recipe cards, decoded",
pub: "Bon Appétit",
year: "2024",
minutes: 9,
topic: "Food",
},
{
title: "The quiet economics of the night shift",
pub: "Harper's",
year: "2024",
minutes: 26,
topic: "Work",
},
];
const TOPICS: ("All" | Topic)[] = ["All", "Cities", "Work", "Food"];
const PASSAGE =
"I write about the people who keep a city running while it sleeps: the bakers, drivers, cleaners and ferry crews who meet the morning before the rest of us. Most of what I know, I learned by staying up with them.";
const BOOKS = [
{
title: "Night Work",
year: "2025",
note: "Essays. Shortlisted for the Orwell Prize.",
tone: "#ff5a1f",
},
{
title: "Harbour Lights",
year: "2022",
note: "A walk around twelve port cities.",
tone: "#2b35ff",
},
];
function Portrait() {
const img = useRef<HTMLImageElement>(null);
const [missing, setMissing] = useState(false);
useEffect(() => {
const el = img.current;
if (el && el.complete && el.naturalWidth === 0) setMissing(true);
}, []);
return (
<div className="gu-writer__portrait">
<span aria-hidden="true">MH</span>
{!missing && (
<img
ref={img}
src="/images/portfolio-writer-portrait-01.jpg"
alt="Maren Holt at a café window table with a notebook, in soft morning light"
onError={() => setMissing(true)}
/>
)}
</div>
);
}
function Newsletter() {
const [sent, setSent] = useState(false);
if (sent)
return (
<p className="gu-writer__thanks" role="status">
Thank you. The next letter arrives on the first Sunday of the month.
</p>
);
return (
<form
className="gu-writer__form"
onSubmit={(e) => {
e.preventDefault();
setSent(true);
}}
>
<label htmlFor="gu-writer-email">Your email</label>
<div>
<input
id="gu-writer-email"
type="email"
required
autoComplete="email"
placeholder="you@example.com"
/>
<button type="submit">Subscribe</button>
</div>
</form>
);
}
export function WriterPortfolio() {
const [topic, setTopic] = useState<"All" | Topic>("All");
const shown = ESSAYS.filter((e) => topic === "All" || e.topic === topic);
const words = PASSAGE.split(" ");
return (
<div className="gu-writer">
<nav className="gu-writer__nav" aria-label="Main">
<a href="#" className="gu-writer__mark">
Maren Holt
</a>
<a href="#writer-essays">Essays</a>
<a href="#writer-books">Books</a>
<a href="#writer-letter">Newsletter</a>
</nav>
<header className="gu-writer__hero">
<div>
<p className="gu-writer__kicker">Essayist and reporter, Rotterdam</p>
<h1>Maren Holt writes about the night shift of the world.</h1>
</div>
<Portrait />
</header>
<section
id="writer-essays"
className="gu-writer__essays"
aria-labelledby="gu-writer-essays"
>
<div className="gu-writer__essays-head">
<h2 id="gu-writer-essays">Selected essays</h2>
<div className="gu-writer__topics" role="group" aria-label="Topic">
{TOPICS.map((t) => (
<button
key={t}
type="button"
aria-pressed={topic === t}
onClick={() => setTopic(t)}
>
{t}
</button>
))}
</div>
</div>
<ul key={topic}>
{shown.map((e, i) => (
<li key={e.title} style={{ "--d": i } as CSSProperties}>
<a href="#">
<span className="gu-writer__title">{e.title}</span>
<span className="gu-writer__meta">
{e.pub}, {e.year}
<span>{e.minutes} min read</span>
</span>
</a>
</li>
))}
</ul>
</section>
<section className="gu-writer__passage" aria-label="About my work">
<p>
<span className="gu-writer__sr">{PASSAGE}</span>
{words.map((w, i) => (
<span
key={i}
className="gu-writer__w"
aria-hidden="true"
style={{ "--i": i / words.length } as CSSProperties}
>
{w}{" "}
</span>
))}
</p>
</section>
<section
id="writer-books"
className="gu-writer__books"
aria-labelledby="gu-writer-books"
>
<h2 id="gu-writer-books">Books</h2>
<ul>
{BOOKS.map((b) => (
<li key={b.title}>
<div
className="gu-writer__cover"
style={{ "--tone": b.tone } as CSSProperties}
aria-hidden="true"
>
<b>{b.title}</b>
<small>Maren Holt</small>
</div>
<h3>{b.title}</h3>
<p>
{b.year}. {b.note}
</p>
</li>
))}
</ul>
</section>
<section
id="writer-letter"
className="gu-writer__letter"
aria-labelledby="gu-writer-letter"
>
<h2 id="gu-writer-letter">
One letter a month, about what I’m reading and who I met.
</h2>
<Newsletter />
</section>
<footer className="gu-writer__foot">
<span>Represented by Hartley & Voss Literary</span>
<a href="mailto:maren@example.com">maren@example.com</a>
</footer>
</div>
);
}
Paste this into ChatGPT, Claude, Cursor, v0, Lovable or Bolt. It describes the layout, motion, colors and accessibility and includes the code, so the AI can rebuild it in any framework.
# Build this UI piece: Writer portfolio
You are a senior front-end engineer. Recreate the piece below in my project. If I don't say which framework I use, ask once, then build it in that framework (React, Vue, Svelte, Angular, Astro, plain HTML/CSS/JS or anything else). Keep the behavior, motion, colors, spacing and accessibility exactly as described. Keep the code clean and commented for beginners.
## What it is
A light, editorial portfolio for an essayist ("Maren Holt", Rotterdam). Its signature: a dark passage where the words light up one by one as the block scrolls through the screen, using CSS scroll-driven animations. Browsers without them simply show the passage at full strength. Sections: nav, hero (a kicker, a big serif headline and a portrait), selected essays with topic filters and reading times, the lit passage, two books drawn as CSS covers, a newsletter sign-up and a footer.
## Palette
Background #f3eee3, surface #fbf8f2, text #0e0e10, muted #57534b, lines rgba(14,14,16,0.16), accent #ff5a1f (essay title underline, first book cover), second cover #2b35ff, focus #2b35ff. Serif stack for headings, titles and the passage: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia. Everything else uses system-ui.
## Layout
- Root uses container queries (container-type: inline-size), side padding 5%.
- Hero: at ≥720px two columns (1.6fr headline, 1fr portrait 4:5, max 420px). The headline goes up to 6.6rem, weight 400 serif, max 14ch.
- Essays: a 1px ink rule on top, the heading with topic pills (All, Cities, Work, Food), then rows with hairlines. Each row is a link with the serif title (up to 2.2rem) and the publication, year and minutes; at ≥760px the meta sits on the right.
- Passage: an ink block, cream serif text up to 3.8rem, max 28ch.
- Books: two CSS book covers (2:3, colored, a darker spine edge on the left, title and author), then title and note.
- Newsletter: a surface band, a serif heading beside an email field and a Subscribe button (both 52px pills). On submit it shows a thank-you line.
## Motion
- Lit passage: each word is a span with `--i` (its position from 0 to 1). With `animation-timeline: view()`, its opacity animates from 0.2 to 1 over `animation-range: cover calc(20% + i × 40%) cover calc(24% + i × 40%)`, wrapped in `@supports`.
- Filtering re-lists the essays, each rising 8px, 60ms apart. An orange 2px underline draws under an essay title on hover.
- Book covers tilt -2° and lift 6px on hover (mouse only).
## Accessibility
- The passage holds the whole sentence once in visually hidden text, and the word spans are aria-hidden, so screen readers read it once, naturally.
- Topic filters are toggle buttons with aria-pressed. The email field has a visible label, type="email", required and autocomplete. The thank-you line has role="status".
- prefers-reduced-motion: the passage is fully lit, rows appear at once, no underline or cover animation.
## Reference implementation
The original is written in React with one plain CSS file. Dependencies: none (plain React and CSS). Translate it faithfully; do not add new libraries unless my framework needs them.
### WriterPortfolio.tsx
```tsx
"use client";
import { useEffect, useRef, useState, type CSSProperties } from "react";
import "./writer-portfolio.css";
/**
* WriterPortfolio: an editorial portfolio for an essayist ("Maren Holt").
* Its signature: a passage whose words light up one by one as it scrolls through
* the screen (CSS scroll-driven animation; browsers without it show the text in full).
*/
type Topic = "Cities" | "Work" | "Food";
const ESSAYS: {
title: string;
pub: string;
year: string;
minutes: number;
topic: Topic;
}[] = [
{
title: "The last night bus in Rotterdam",
pub: "The Atlantic",
year: "2026",
minutes: 14,
topic: "Cities",
},
{
title: "What a bakery knows about 4am",
pub: "The New Yorker",
year: "2026",
minutes: 22,
topic: "Food",
},
{
title: "Notes from a year of four-day weeks",
pub: "Wired",
year: "2025",
minutes: 11,
topic: "Work",
},
{
title: "Why every city wants a harbour again",
pub: "Guardian Long Read",
year: "2025",
minutes: 18,
topic: "Cities",
},
{
title: "My grandmother's recipe cards, decoded",
pub: "Bon Appétit",
year: "2024",
minutes: 9,
topic: "Food",
},
{
title: "The quiet economics of the night shift",
pub: "Harper's",
year: "2024",
minutes: 26,
topic: "Work",
},
];
const TOPICS: ("All" | Topic)[] = ["All", "Cities", "Work", "Food"];
const PASSAGE =
"I write about the people who keep a city running while it sleeps: the bakers, drivers, cleaners and ferry crews who meet the morning before the rest of us. Most of what I know, I learned by staying up with them.";
const BOOKS = [
{
title: "Night Work",
year: "2025",
note: "Essays. Shortlisted for the Orwell Prize.",
tone: "#ff5a1f",
},
{
title: "Harbour Lights",
year: "2022",
note: "A walk around twelve port cities.",
tone: "#2b35ff",
},
];
function Portrait() {
const img = useRef<HTMLImageElement>(null);
const [missing, setMissing] = useState(false);
useEffect(() => {
const el = img.current;
if (el && el.complete && el.naturalWidth === 0) setMissing(true);
}, []);
return (
<div className="gu-writer__portrait">
<span aria-hidden="true">MH</span>
{!missing && (
<img
ref={img}
src="/images/portfolio-writer-portrait-01.jpg"
alt="Maren Holt at a café window table with a notebook, in soft morning light"
onError={() => setMissing(true)}
/>
)}
</div>
);
}
function Newsletter() {
const [sent, setSent] = useState(false);
if (sent)
return (
<p className="gu-writer__thanks" role="status">
Thank you. The next letter arrives on the first Sunday of the month.
</p>
);
return (
<form
className="gu-writer__form"
onSubmit={(e) => {
e.preventDefault();
setSent(true);
}}
>
<label htmlFor="gu-writer-email">Your email</label>
<div>
<input
id="gu-writer-email"
type="email"
required
autoComplete="email"
placeholder="you@example.com"
/>
<button type="submit">Subscribe</button>
</div>
</form>
);
}
export function WriterPortfolio() {
const [topic, setTopic] = useState<"All" | Topic>("All");
const shown = ESSAYS.filter((e) => topic === "All" || e.topic === topic);
const words = PASSAGE.split(" ");
return (
<div className="gu-writer">
<nav className="gu-writer__nav" aria-label="Main">
<a href="#" className="gu-writer__mark">
Maren Holt
</a>
<a href="#writer-essays">Essays</a>
<a href="#writer-books">Books</a>
<a href="#writer-letter">Newsletter</a>
</nav>
<header className="gu-writer__hero">
<div>
<p className="gu-writer__kicker">Essayist and reporter, Rotterdam</p>
<h1>Maren Holt writes about the night shift of the world.</h1>
</div>
<Portrait />
</header>
<section
id="writer-essays"
className="gu-writer__essays"
aria-labelledby="gu-writer-essays"
>
<div className="gu-writer__essays-head">
<h2 id="gu-writer-essays">Selected essays</h2>
<div className="gu-writer__topics" role="group" aria-label="Topic">
{TOPICS.map((t) => (
<button
key={t}
type="button"
aria-pressed={topic === t}
onClick={() => setTopic(t)}
>
{t}
</button>
))}
</div>
</div>
<ul key={topic}>
{shown.map((e, i) => (
<li key={e.title} style={{ "--d": i } as CSSProperties}>
<a href="#">
<span className="gu-writer__title">{e.title}</span>
<span className="gu-writer__meta">
{e.pub}, {e.year}
<span>{e.minutes} min read</span>
</span>
</a>
</li>
))}
</ul>
</section>
<section className="gu-writer__passage" aria-label="About my work">
<p>
<span className="gu-writer__sr">{PASSAGE}</span>
{words.map((w, i) => (
<span
key={i}
className="gu-writer__w"
aria-hidden="true"
style={{ "--i": i / words.length } as CSSProperties}
>
{w}{" "}
</span>
))}
</p>
</section>
<section
id="writer-books"
className="gu-writer__books"
aria-labelledby="gu-writer-books"
>
<h2 id="gu-writer-books">Books</h2>
<ul>
{BOOKS.map((b) => (
<li key={b.title}>
<div
className="gu-writer__cover"
style={{ "--tone": b.tone } as CSSProperties}
aria-hidden="true"
>
<b>{b.title}</b>
<small>Maren Holt</small>
</div>
<h3>{b.title}</h3>
<p>
{b.year}. {b.note}
</p>
</li>
))}
</ul>
</section>
<section
id="writer-letter"
className="gu-writer__letter"
aria-labelledby="gu-writer-letter"
>
<h2 id="gu-writer-letter">
One letter a month, about what I’m reading and who I met.
</h2>
<Newsletter />
</section>
<footer className="gu-writer__foot">
<span>Represented by Hartley & Voss Literary</span>
<a href="mailto:maren@example.com">maren@example.com</a>
</footer>
</div>
);
}
```
### writer-portfolio.css
```css
/* WriterPortfolio: change these colors and fonts to match your brand. */
.gu-writer {
--bg: #f3eee3;
--surface: #fbf8f2;
--text: #0e0e10;
--muted: #57534b;
--line: rgb(14 14 16 / 0.16);
--accent: #ff5a1f;
--focus: #2b35ff;
--serif:
"Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, serif;
--ease: cubic-bezier(0.16, 1, 0.3, 1);
container-type: inline-size;
overflow-x: clip;
background: var(--bg);
color: var(--text);
font-family: system-ui, sans-serif;
}
.gu-writer a {
color: inherit;
text-decoration: none;
}
.gu-writer :focus-visible {
outline: 2px solid var(--focus);
outline-offset: 3px;
}
.gu-writer h1,
.gu-writer h2,
.gu-writer h3,
.gu-writer p {
margin: 0;
}
.gu-writer__sr {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
.gu-writer h1,
.gu-writer h2,
.gu-writer h3 {
font-family: var(--serif);
font-weight: 400;
}
.gu-writer__nav {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 22px;
padding: 18px 5%;
border-bottom: 1px solid var(--line);
font-size: 0.95rem;
}
.gu-writer__mark {
margin-right: auto;
font-family: var(--serif);
font-size: 1.3rem;
font-style: italic;
}
.gu-writer__nav a:not(.gu-writer__mark):hover {
text-decoration: underline;
text-underline-offset: 4px;
}
/* Hero */
.gu-writer__hero {
display: grid;
gap: 32px;
padding: 56px 5% 64px;
}
@container (min-width: 720px) {
.gu-writer__hero {
grid-template-columns: 1.6fr 1fr;
align-items: end;
}
}
.gu-writer__kicker {
margin-bottom: 18px !important;
font-weight: 600;
color: var(--muted);
}
.gu-writer__hero h1 {
max-width: 14ch;
font-size: clamp(2.8rem, 8cqi, 6.6rem);
line-height: 0.95;
letter-spacing: -0.03em;
text-wrap: balance;
}
.gu-writer__portrait {
position: relative;
overflow: hidden;
aspect-ratio: 4 / 5;
max-width: 420px;
border-radius: 4px;
background: linear-gradient(160deg, #e9e2d3, #c9bfae);
}
.gu-writer__portrait span {
position: absolute;
inset: 0;
display: grid;
place-items: center;
font-family: var(--serif);
font-size: 4rem;
color: rgb(14 14 16 / 0.35);
}
.gu-writer__portrait img {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
/* Essays */
.gu-writer__essays {
padding: 56px 5%;
border-top: 1px solid var(--text);
}
.gu-writer__essays-head {
display: flex;
flex-wrap: wrap;
align-items: end;
justify-content: space-between;
gap: 18px;
margin-bottom: 20px;
}
.gu-writer__essays h2,
.gu-writer__books h2 {
font-size: clamp(2rem, 5cqi, 3.4rem);
letter-spacing: -0.02em;
}
.gu-writer__topics {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.gu-writer__topics button {
min-height: 40px;
padding: 0 14px;
border: 1px solid var(--line);
border-radius: 999px;
background: transparent;
color: var(--muted);
font: inherit;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
}
.gu-writer__topics button[aria-pressed="true"] {
border-color: var(--text);
background: var(--text);
color: var(--bg);
}
.gu-writer__essays ul {
margin: 0;
padding: 0;
list-style: none;
}
.gu-writer__essays li {
border-bottom: 1px solid var(--line);
animation: gu-writer-in 0.5s var(--ease) both;
animation-delay: calc(var(--d) * 60ms);
}
@keyframes gu-writer-in {
from {
opacity: 0;
transform: translateY(8px);
}
}
.gu-writer__essays li a {
display: grid;
gap: 6px;
padding: 20px 0;
}
@container (min-width: 760px) {
.gu-writer__essays li a {
grid-template-columns: 1fr auto;
align-items: baseline;
gap: 24px;
}
}
.gu-writer__title {
font-family: var(--serif);
font-size: clamp(1.4rem, 3.2cqi, 2.2rem);
line-height: 1.15;
background: linear-gradient(var(--accent), var(--accent)) left 92% / 0% 2px
no-repeat;
transition: background-size 0.5s var(--ease);
}
.gu-writer__essays li a:hover .gu-writer__title {
background-size: 100% 2px;
}
.gu-writer__meta {
display: flex;
gap: 14px;
font-size: 0.9rem;
color: var(--muted);
white-space: nowrap;
}
.gu-writer__meta span {
font-variant-numeric: tabular-nums;
}
/* Scroll-lit passage */
.gu-writer__passage {
padding: 96px 5%;
background: var(--text);
color: var(--bg);
}
.gu-writer__passage p {
max-width: 28ch;
font-family: var(--serif);
font-size: clamp(1.8rem, 5cqi, 3.8rem);
line-height: 1.15;
letter-spacing: -0.015em;
}
@supports (animation-timeline: view()) {
.gu-writer__w {
opacity: 0.2;
animation: gu-writer-lit linear both;
animation-timeline: view();
animation-range: cover calc(20% + var(--i) * 40%) cover
calc(24% + var(--i) * 40%);
}
@keyframes gu-writer-lit {
to {
opacity: 1;
}
}
}
/* Books */
.gu-writer__books {
padding: 72px 5%;
}
.gu-writer__books ul {
display: grid;
gap: 32px;
margin: 32px 0 0;
padding: 0;
list-style: none;
}
@container (min-width: 640px) {
.gu-writer__books ul {
grid-template-columns: repeat(2, minmax(0, 320px));
}
}
.gu-writer__cover {
display: grid;
align-content: space-between;
aspect-ratio: 2 / 3;
max-width: 260px;
padding: 22px;
border-radius: 2px 8px 8px 2px;
background: var(--tone);
color: var(--text);
box-shadow:
inset 6px 0 0 rgb(0 0 0 / 0.14),
0 24px 40px -24px rgb(14 14 16 / 0.6);
transition: transform 0.6s var(--ease);
}
.gu-writer__cover b {
font-family: var(--serif);
font-weight: 400;
font-size: 2.2rem;
line-height: 1;
}
.gu-writer__books li:nth-child(2) .gu-writer__cover {
color: var(--bg);
}
@media (hover: hover) {
.gu-writer__books li:hover .gu-writer__cover {
transform: rotate(-2deg) translateY(-6px);
}
}
.gu-writer__books h3 {
margin-top: 18px;
font-size: 1.5rem;
}
.gu-writer__books p {
margin-top: 4px;
color: var(--muted);
}
/* Newsletter */
.gu-writer__letter {
display: grid;
gap: 24px;
padding: 64px 5%;
border-top: 1px solid var(--text);
background: var(--surface);
}
@container (min-width: 760px) {
.gu-writer__letter {
grid-template-columns: 1fr 1fr;
align-items: end;
}
}
.gu-writer__letter h2 {
max-width: 20ch;
font-size: clamp(1.8rem, 4cqi, 2.8rem);
line-height: 1.1;
}
.gu-writer__form {
display: grid;
gap: 8px;
}
.gu-writer__form label {
font-weight: 600;
}
.gu-writer__form > div {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.gu-writer__form input {
flex: 1 1 200px;
min-width: 0;
min-height: 52px;
padding: 0 16px;
border: 1px solid var(--text);
border-radius: 999px;
background: var(--bg);
color: var(--text);
font: inherit;
}
.gu-writer__form button {
min-height: 52px;
padding: 0 22px;
border: 0;
border-radius: 999px;
background: var(--text);
color: var(--bg);
font: inherit;
font-weight: 800;
cursor: pointer;
}
.gu-writer__thanks {
font-family: var(--serif);
font-size: 1.4rem;
}
.gu-writer__foot {
display: flex;
flex-wrap: wrap;
gap: 8px 20px;
justify-content: space-between;
padding: 20px 5%;
font-size: 0.88rem;
color: var(--muted);
}
@media (prefers-reduced-motion: reduce) {
.gu-writer__essays li,
.gu-writer__w {
animation: none;
opacity: 1;
}
.gu-writer__title,
.gu-writer__cover {
transition: none;
}
}
```
You might also want
Next piece: 3D tilt cardPrivate chef portfolio with a dinner builder
Portfolios, advanced
Developer portfolio
Portfolios, intermediate
Fashion designer portfolio with a lookbook loupe
Portfolios, advanced
