design
Technical notes on web development, DevOps, and AI integration.
7 articles
- 00:40frontend
Deep-Link Video in Mega Menu: URL, State, Preload Done Right
Three URL layers for mega menu video deep-links: path for identity, query for panel state, hash for timestamp. Manual sync of video.currentTime to hash. Preload metadata + poster, not auto. Prefetch route on hover, not auto.
TL;DR: Use path segments for video identity, query strings for panel state, and hash fragments for timestamps to create bookmarkable URLs. React Activity preserves component state but not video playback, so manually sync currentTime with the hash on mount and timeupdate. For mega panels, set preload="metadata" with posters and manually prefetch on hover since hidden elements skip automatic prefetching.
#frontend#performance#nextjs - 03:45backend
When to Export a Go Symbol
A test migration into external packages doubles as an API audit: three doors between public-path rewrites, real exports, and export_test.go.
TL;DR: Moving tests out of a package forces every internal function through one of three doors: rewrite via public paths, make a real export, or use export_test.go. A supposedly test-only commit exposed four importer functions worth exporting, revealing hidden API value. Test migrations double as free API audits, with zero exports signaling a healthy public interface.
#go#api-design#testing - 23:48frontend
Tests That Lock Design Intent, Not Screenshots
Design intent does not survive on documentation alone. A 129-line unit test pins the house classes, so drift breaks the build, not the quarterly audit.
TL;DR: When a fresh restyle kept slipping back to old borders and colors, thicker documentation didn’t stop the drift. So the team shipped a 129-line test that renders components to static markup and checks exact Tailwind classes. It now catches silent design changes in CI and enforces token-only styles before shipping.
#testing#vitest#tailwind - 13:59frontend
One Design Language for Every Page
The homepage redesign left five subpages looking like a different website. The fix was not restyling each page by hand but extracting shared components.
TL;DR: Shipping a polished homepage exposed inconsistent spacing, heroes and buttons across other pages. Instead of patching each page, the fix extended two components, page-hero.tsx and page-cta.tsx, plus a borderless card pattern using layered gradients, CSS variable tokens and consistent pill buttons. Pages now share the same visual language through props while keeping unique content, so updates happen in one place.
#css#design#frontend - 18:35frontend
Why I Put 92% Alpha in My Header Token Instead of Using bg-white/60
Dark navy header felt heavy in light mode. The fix: bake 92% alpha into the --color-header token so backdrop-blur works everywhere without per-component overrides.
TL;DR: Slapping bg-white/60 on a navbar breaks fast, since child elements inherit transparency and fixes scatter across files. The fix is baking alpha into a --color-header token (about 92 percent opacity), which cascades to every consumer and pairs cleanly with backdrop-blur-md. Trade-off: the header decouples from the global background token, but one line brings it back if needed.
#css#tailwind#design - 15:30frontend
The Context Panel Stopped Being a Card: Border Became a Divider
The right context panel dropped its floating-card frame for a single left-border divider, matching the sidebar's design language.
TL;DR: The author changed a right panel from floating card to flush panel by swapping rounded corners and a four-sided border for a single left border. The border's job shifted from frame to divider, not removal. Lesson: when converting a card to a panel, ask what the border should do now.
#css#tailwind#frontend - 03:12frontend
My Light-Mode Navbar Uses bg-white/60, Not the Token
Brightening the shared background token shifts the whole page. A navbar needs a solid chrome feel, so a literal color plus the dark variant wins.
TL;DR: Light mode made the navbar look like dirty glass because the shared background token added a grayish cast. The fix swaps in literal bg-white utilities for light mode in both scroll branches while dark mode keeps the token. Trade-off: the navbar won't follow future theme changes, but a dedicated token is a one-line swap later.
#css#tailwind#design