A photography portfolio built to last
I first met Malik through a Riverside Art Museum zine I was hired to design in 2025. We stayed in touch, and when he was ready, I built the portfolio I'd kept the door open for.
A home he runs
I met Malik through a zine I was contracted to design for the Riverside Art Museum in 2025. His story was one of the features inside. We stayed in touch, and I told him I'd build his portfolio whenever he was ready.
Malik is an independent photographer from San Bernardino. His longest project is Eclipse, a community photography space, and his work has been shown at the Riverside Art Museum and alongside the Civil Rights Institute of Southern California. The work already had institutions behind it. It didn't have a place of its own.
A photographer's site has to show the photos first and still be his to change after I'm gone.
Photography as spatial experience
The site is white, with one typeface for everything and a serif italic for his birth year and hometown. The header uses mix-blend-difference, so it stays readable over any photo without a bar behind it.
Who holds the words
My first rule was that only the photos went into the CMS. His bio, tagline and contact lived in code, so the voice of the site couldn't drift. In April that was the rule: only the gallery was managed in Sanity, and every other word lived in the code.
That rule didn't last. His Info page and site settings moved into Sanity the next day. By July the bio, portrait, tagline and contact were all in Sanity, the Studio had moved out of the site into its own app, and none of his photos lived in the code anymore.
Paths not taken
What I didn't build: a shop, a blog, booking, or project pages. Each photo has a title, a place and a year, and that's the whole content model.
One photo at a time
The first version, built in November, opened on his tagline in blue on a white field, with every photo below it in a staggered grid. The nav read Overview, Info and Contact.
In April I rebuilt the home page around a single photo. The grid moved to its own Gallery page, the type went black, and the blue stayed only on the phone menu.
The strip fits the width
The home page is one photo and one row of thumbnails across the middle. My first strip was a scroller with a fixed count, and on most screens the last few sat off the edge. It read as a carousel to swipe, not a contact sheet to scan.
Now the row has a fixed height, 72px on desktop, and takes photos in order until the next one wouldn't fit. Each thumbnail keeps its own ratio, so a portrait takes 48px and a landscape 108px. The row always spans edge to edge and never scrolls.
Loading preview…
Show code
"use client";
import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent } from "react";
import { cn } from "@/lib/utils";
export type FilmstripItem = {
/** Intrinsic size; thumb width is row height × ratio. */
width: number;
height: number;
/** Omit to draw a grey stand-in at the item's ratio. */
src?: string;
title?: string;
};
export type FilmstripHeroProps = {
items: FilmstripItem[];
/** Called with the item index and the click, on frames 768px and wider. */
onOpen?: (index: number, event: MouseEvent) => void;
/** Item shown before the first hover. */
defaultIndex?: number;
label?: string;
className?: string;
};
// Row height and how many items the strip may draw from, by frame width
// (the original's 768 / 1024 breakpoints, read from the frame, not the window).
function layoutFor(width: number) {
if (width < 768) return { rowHeight: 48, max: 12, compact: true };
if (width < 1024) return { rowHeight: 64, max: 12, compact: false };
return { rowHeight: 72, max: 24, compact: false };
}
const EASE = "cubic-bezier(0.4, 0, 0.2, 1)";
/**
* Greedily take items until the next one would overflow, so the strip spans
* the frame at one row height and never scrolls. Always keeps at least one.
*/
export function fitToWidth<T extends { width: number; height: number }>(items: T[], rowHeight: number, width: number) {
if (!width) return items;
const fitted: T[] = [];
let used = 0;
for (const item of items) {
const w = rowHeight * (item.width && item.height ? item.width / item.height : 1);
if (used + w > width) break;
used += w;
fitted.push(item);
}
return fitted.length > 0 ? fitted : items.slice(0, 1);
}
function Media({ item, className, style }: { item: FilmstripItem; className?: string; style?: CSSProperties }) {
const ratio = item.width / item.height;
if (item.src) {
// eslint-disable-next-line @next/next/no-img-element
return <img src={item.src} alt="" loading="eager" decoding="async" className={cn("object-contain", className)} style={style} />;
}
return (
<span aria-hidden className={cn("flex items-center justify-center [container-type:size]", className)} style={style}>
<span className="block bg-muted" style={{ aspectRatio: ratio, width: `min(100cqw, ${100 * ratio}cqh)` }} />
</span>
);
}
export function FilmstripHero({
items,
onOpen,
defaultIndex = 0,
label = "Featured photos",
className,
}: FilmstripHeroProps) {
const rootRef = useRef<HTMLDivElement>(null);
const [frameWidth, setFrameWidth] = useState(0);
const [active, setActive] = useState(defaultIndex);
// Size from the frame itself, so the strip works in any box, not just a
// full-viewport page. offsetWidth ignores CSS transforms (scaled previews).
useLayoutEffect(() => {
const el = rootRef.current;
if (!el) return;
const ro = new ResizeObserver(() => setFrameWidth(el.offsetWidth));
ro.observe(el);
setFrameWidth(el.offsetWidth);
return () => ro.disconnect();
}, []);
const { rowHeight, max, compact } = layoutFor(frameWidth || 1024);
const thumbs = useMemo(() => fitToWidth(items.slice(0, max), rowHeight, frameWidth), [items, max, rowHeight, frameWidth]);
const activeIndex = active < thumbs.length ? active : 0;
const current = thumbs[activeIndex];
const canOpen = Boolean(onOpen) && !compact;
const nameOf = (item: FilmstripItem | undefined, i: number) => item?.title || `Photo ${i + 1} of ${thumbs.length}`;
return (
<div ref={rootRef} className={cn("relative h-full w-full overflow-hidden", className)}>
{/* Every image stays mounted and stacked; hover only changes which one
is opaque, so a swap is a 600ms crossfade with nothing to load. */}
<div
className={cn("absolute inset-0", canOpen && "cursor-pointer")}
onClick={canOpen ? (e) => onOpen?.(activeIndex, e) : undefined}
aria-hidden
>
{thumbs.map((item, i) => (
<Media
key={i}
item={item}
className="pointer-events-none absolute inset-0 h-full w-full transition-opacity motion-reduce:transition-none"
style={{ opacity: i === activeIndex ? 1 : 0, transitionDuration: "600ms", transitionTimingFunction: EASE }}
/>
))}
</div>
<div
role="group"
aria-label={label}
className="absolute inset-x-0 top-1/2 z-10 flex -translate-y-1/2 items-center justify-between overflow-hidden"
>
{thumbs.map((item, i) => {
const isActive = i === activeIndex;
return (
<button
key={i}
type="button"
aria-label={canOpen ? `Open ${nameOf(item, i)}` : nameOf(item, i)}
onPointerEnter={() => setActive(i)}
onFocus={() => setActive(i)}
onClick={(e) => {
setActive(i);
if (canOpen) onOpen?.(i, e);
}}
className={cn(
"block shrink-0 outline-none transition-[opacity,filter] focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none",
canOpen && "cursor-pointer",
)}
style={{
height: rowHeight,
opacity: isActive ? 1 : 0.2,
filter: isActive ? "grayscale(0%)" : "grayscale(100%)",
transitionDuration: "400ms",
transitionTimingFunction: EASE,
}}
>
{item.src ? (
// eslint-disable-next-line @next/next/no-img-element
<img src={item.src} alt="" decoding="async" className="block h-full w-auto" />
) : (
<span
aria-hidden
className="block h-full bg-muted-foreground/60"
style={{ aspectRatio: item.width / item.height }}
/>
)}
</button>
);
})}
</div>
<span className="sr-only" aria-live="polite">
{nameOf(current, activeIndex)}
</span>
</div>
);
}The active thumbnail is the only one in colour. The rest drop to 20% and greyscale over 400ms, while the photo behind fades in over 600ms. The slower background lets a quick sweep blur into a single move.
The photo is the control
Clicking the hero or any photo in the gallery opens the lightbox. It has no arrows and no close button. The left half of the photo goes back, the right half goes forward, and clicking outside it closes.
A small label follows the pointer to say which zone you're in: [PREV], [NEXT] or [ESC]. It trails the hand a little, closing 15% of the gap each frame, and flips from black on white to white on black when it crosses onto the photo.
Opening takes 220ms and closing 180ms. The first version closed in 300ms, which felt slow on something you do after every photo.
Proof
Maliklphoto.xyz is live with 99 photos in the gallery. Every word and image on it comes from Sanity, and an edit in the Studio reaches the site within a minute. If Sanity is ever unreachable, the pages fall back to the launch copy instead of rendering blank.
The cost is weight up front. The home page loads up to 24 full-size photos at once so a hover never waits, and the Studio is a second app to deploy and keep updated.
Maliklphoto.xyzLearnings
If they'll own it, the CMS holds everything.
I drew the CMS line to protect his voice, but it also meant every change still went through me. Handing over a site means handing over the words too, with fallbacks in code so nothing breaks while he learns the Studio.
The question I haven't answered is what keeps a site like this alive once the launch is over. A portfolio he can edit isn't one he will.
Interactions
npx shadcn@latest add \
https://benjaminuribe.com/r/filmstrip-hero.jsonA one-page index for a designer who also shoots and cuts video
Brooks makes the cover, shoots the show and cuts the reel, often for the same artist. The site had to hold all three without becoming three portfolios.
